Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 May 2017 05:33:16 +0000 (UTC)
From:      Scott Long <scottl@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r317726 - head/sys/cam
Message-ID:  <201705030533.v435XGkR078423@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: scottl
Date: Wed May  3 05:33:15 2017
New Revision: 317726
URL: https://svnweb.freebsd.org/changeset/base/317726

Log:
  Fix an unsafe malloc usage with sbufs.
  
  Reported by:	ken
  Sponsored by:	Netflix

Modified:
  head/sys/cam/cam_periph.c

Modified: head/sys/cam/cam_periph.c
==============================================================================
--- head/sys/cam/cam_periph.c	Wed May  3 04:42:35 2017	(r317725)
+++ head/sys/cam/cam_periph.c	Wed May  3 05:33:15 2017	(r317726)
@@ -643,8 +643,9 @@ cam_periph_invalidate(struct cam_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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705030533.v435XGkR078423>