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);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to