svn commit: r319139 - stable/11/usr.sbin/bhyve
Pedro F. Giffuni
pfg at FreeBSD.org
Mon May 29 15:24:47 UTC 2017
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));
}
}
More information about the svn-src-stable-11
mailing list