From da0d7209e07e08ae4bda9bd7af744e20941b58b1 Mon Sep 17 00:00:00 2001 From: Scott Long Date: Wed, 3 May 2017 05:33:15 +0000 Subject: [PATCH] Fix an unsafe malloc usage with sbufs. Reported by: ken Sponsored by: Netflix --- sys/cam/cam_periph.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c index 57acd907d662..bfc98024bd50 100644 --- a/sys/cam/cam_periph.c +++ b/sys/cam/cam_periph.c @@ -643,8 +643,9 @@ cam_periph_invalidate(struct cam_periph *periph) CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph invalidated\n")); if ((periph->flags & CAM_PERIPH_ANNOUNCED) && !rebooting) { struct sbuf sb; + char buffer[160]; - sbuf_new(&sb, NULL, 160, SBUF_FIXEDLEN); + sbuf_new(&sb, buffer, 160, SBUF_FIXEDLEN); xpt_denounce_periph_sbuf(periph, &sb); sbuf_finish(&sb); sbuf_putbuf(&sb);