summaryrefslogtreecommitdiff
path: root/usr.sbin/kvm_mkdb/nlist.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2007-09-02 15:19:41 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2007-09-02 15:19:41 +0000
commit6ebd04219f0d749c87a763e8afb578dfcd5223cc (patch)
treebb0f29e0a3791fff88551c93f5d4ba7113bdba43 /usr.sbin/kvm_mkdb/nlist.c
parentbe524287dc216d876f995eddcaf32762c702c6e9 (diff)
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.c6
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);