diff options
author | Doug Hogan <doug@cvs.openbsd.org> | 2014-09-24 00:13:14 +0000 |
---|---|---|
committer | Doug Hogan <doug@cvs.openbsd.org> | 2014-09-24 00:13:14 +0000 |
commit | 56edc1950595069e4405a5439ab2706258675dc4 (patch) | |
tree | c435ba71a8a5ce17ca3cbda5d08d24ed16774217 /sys/dev/microcode | |
parent | 7765166403e6680b36e8f340204bb4fcdb196605 (diff) |
Replace a few malloc() calls with reallocarray() so it checks for overflow.
ok deraadt@
Diffstat (limited to 'sys/dev/microcode')
-rw-r--r-- | sys/dev/microcode/bwi/extract/extract.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/microcode/bwi/extract/extract.c b/sys/dev/microcode/bwi/extract/extract.c index a0304b7e500..d7cc17d710b 100644 --- a/sys/dev/microcode/bwi/extract/extract.c +++ b/sys/dev/microcode/bwi/extract/extract.c @@ -1,4 +1,4 @@ -/* $OpenBSD: extract.c,v 1.3 2014/07/12 19:01:49 tedu Exp $ */ +/* $OpenBSD: extract.c,v 1.4 2014/09/24 00:13:13 doug Exp $ */ /* * Copyright (c) 2006 Marcus Glocker <mglocker@openbsd.org> @@ -53,7 +53,7 @@ main(int argc, char *argv[]) nfiles = ntohl(nfiles); /* allocate space for header struct */ - if ((h = malloc(nfiles * sizeof(*h))) == NULL) + if ((h = reallocarray(NULL, nfiles, sizeof(*h))) == NULL) err(1, "malloc"); for (i = 0; i < nfiles; i++) { if ((h[i] = malloc(sizeof(struct header))) == NULL) |