Fix an unsafe malloc usage with sbufs.

Reported by:	ken
Sponsored by:	Netflix
This commit is contained in:
Scott Long 2017-05-03 05:33:15 +00:00
parent e83177fba8
commit da0d7209e0

View File

@ -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);