diff options
| author | 2014-09-24 00:13:13 +0000 | |
|---|---|---|
| committer | 2014-09-24 00:13:13 +0000 | |
| commit | 0ea7e100bde0eee53094d329f727c2d680c34321 (patch) | |
| tree | 1deb75077bc81d687118b300787fac3d8934a9e5 /sys/dev/microcode | |
| parent | Enable MSI support. (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) |
