diff options
author | deraadt <deraadt@openbsd.org> | 2007-09-02 15:19:07 +0000 |
---|---|---|
committer | deraadt <deraadt@openbsd.org> | 2007-09-02 15:19:07 +0000 |
commit | 1ed98fdf61d9dd29369f246109081408082ce54d (patch) | |
tree | ad7631e58c83830d1fc51cbadb9a2da53c1abfb7 /usr.sbin/kvm_mkdb/nlist.c | |
parent | OpenCVS server init-support with OpenCVS and GNU cvs clients. (diff) | |
download | wireguard-openbsd-1ed98fdf61d9dd29369f246109081408082ce54d.tar.xz wireguard-openbsd-1ed98fdf61d9dd29369f246109081408082ce54d.zip |
use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg
Diffstat (limited to 'usr.sbin/kvm_mkdb/nlist.c')
-rw-r--r-- | usr.sbin/kvm_mkdb/nlist.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/kvm_mkdb/nlist.c b/usr.sbin/kvm_mkdb/nlist.c index 04bf9c0716c..d29339f8a8c 100644 --- a/usr.sbin/kvm_mkdb/nlist.c +++ b/usr.sbin/kvm_mkdb/nlist.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nlist.c,v 1.36 2007/03/18 16:28:10 mickey Exp $ */ +/* $OpenBSD: nlist.c,v 1.37 2007/09/02 15:19:38 deraadt Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -33,7 +33,7 @@ #if 0 static char sccsid[] = "from: @(#)nlist.c 8.1 (Berkeley) 6/6/93"; #else -static const char rcsid[] = "$OpenBSD: nlist.c,v 1.36 2007/03/18 16:28:10 mickey Exp $"; +static const char rcsid[] = "$OpenBSD: nlist.c,v 1.37 2007/09/02 15:19:38 deraadt Exp $"; #endif #endif /* not lint */ @@ -317,7 +317,7 @@ __elf_knlist(int fd, DB *db, int ksyms) !IS_ELF(eh)) return (1); - sh = (Elf_Shdr *)malloc(sizeof(Elf_Shdr) * eh.e_shnum); + sh = (Elf_Shdr *)calloc(sizeof(Elf_Shdr), eh.e_shnum); if (sh == NULL) errx(1, "cannot allocate %d bytes for symbol header", sizeof(Elf_Shdr) * eh.e_shnum); |