diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2007-09-02 15:19:41 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2007-09-02 15:19:41 +0000 |
commit | 6ebd04219f0d749c87a763e8afb578dfcd5223cc (patch) | |
tree | bb0f29e0a3791fff88551c93f5d4ba7113bdba43 /usr.sbin/memconfig | |
parent | be524287dc216d876f995eddcaf32762c702c6e9 (diff) |
use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg
Diffstat (limited to 'usr.sbin/memconfig')
-rw-r--r-- | usr.sbin/memconfig/memconfig.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/memconfig/memconfig.c b/usr.sbin/memconfig/memconfig.c index 27ac18c07de..12b6ebdea3e 100644 --- a/usr.sbin/memconfig/memconfig.c +++ b/usr.sbin/memconfig/memconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: memconfig.c,v 1.11 2006/03/14 19:23:16 moritz Exp $ */ +/* $OpenBSD: memconfig.c,v 1.12 2007/09/02 15:19:39 deraadt Exp $ */ /*- * Copyright (c) 1999 Michael Smith <msmith@freebsd.org> @@ -134,7 +134,7 @@ mrgetall(int memfd, int *nmr) err(1, "can't size range descriptor array"); *nmr = mro.mo_arg[0]; - mrd = malloc(*nmr * sizeof(struct mem_range_desc)); + mrd = calloc(*nmr, sizeof(struct mem_range_desc)); if (mrd == NULL) errx(1, "can't allocate %zu bytes for %d range descriptors", *nmr * sizeof(struct mem_range_desc), *nmr); |