Date: Mon, 29 May 2017 15:24:45 +0000 (UTC) From: "Pedro F. Giffuni" <pfg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r319139 - stable/11/usr.sbin/bhyve Message-ID: <201705291524.v4TFOjWc055281@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pfg Date: Mon May 29 15:24:45 2017 New Revision: 319139 URL: https://svnweb.freebsd.org/changeset/base/319139 Log: MFC r318788: bhyvegc_resize: make use of reallocarray(3) for bounds-checking. Also add __FBSDID. Reviewed by: grehan Modified: stable/11/usr.sbin/bhyve/bhyvegc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bhyve/bhyvegc.c ============================================================================== --- stable/11/usr.sbin/bhyve/bhyvegc.c Mon May 29 13:38:26 2017 (r319138) +++ stable/11/usr.sbin/bhyve/bhyvegc.c Mon May 29 15:24:45 2017 (r319139) @@ -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)); } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705291524.v4TFOjWc055281>