mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-29 12:03:03 +00:00
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).
This commit is contained in:
parent
e058e1c43c
commit
880f26f3eb
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=318788
@ -1,4 +1,5 @@
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
@ -56,9 +57,11 @@ bhyvegc_resize(struct bhyvegc *gc, int width, int height)
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user