Author: pfg Date: Wed May 24 14:24:47 2017 New Revision: 318788 URL: https://svnweb.freebsd.org/changeset/base/318788
Log: bhyvegc_resize: make use of reallocarray(3) for bounds-checking. Also add __FBSDID. Reviewed by: grehan This file lacks a license(!) so for this change the following declaration applies: To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action). Modified: head/usr.sbin/bhyve/bhyvegc.c Modified: head/usr.sbin/bhyve/bhyvegc.c ============================================================================== --- head/usr.sbin/bhyve/bhyvegc.c Wed May 24 14:22:22 2017 (r318787) +++ head/usr.sbin/bhyve/bhyvegc.c Wed May 24 14:24:47 2017 (r318788) @@ -1,4 +1,5 @@ #include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); #include <sys/types.h> @@ -56,9 +57,11 @@ bhyvegc_resize(struct bhyvegc *gc, int w gc_image->width = width; gc_image->height = height; if (!gc->raw) { - gc_image->data = realloc(gc_image->data, - sizeof (uint32_t) * width * height); - memset(gc_image->data, 0, width * height * sizeof (uint32_t)); + gc_image->data = reallocarray(gc_image->data, width * height, + sizeof (uint32_t)); + if (gc_image->data != NULL) + memset(gc_image->data, 0, width * height * + sizeof (uint32_t)); } } _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"