summaryrefslogtreecommitdiff
path: root/libexec/ld.so
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 /libexec/ld.so
parentbe524287dc216d876f995eddcaf32762c702c6e9 (diff)
use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg
Diffstat (limited to 'libexec/ld.so')
-rw-r--r--libexec/ld.so/ldconfig/prebind.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libexec/ld.so/ldconfig/prebind.c b/libexec/ld.so/ldconfig/prebind.c
index c4d2080fddc..2fdfc09dce0 100644
--- a/libexec/ld.so/ldconfig/prebind.c
+++ b/libexec/ld.so/ldconfig/prebind.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: prebind.c,v 1.8 2006/11/13 13:13:14 drahn Exp $ */
+/* $OpenBSD: prebind.c,v 1.9 2007/09/02 15:19:20 deraadt Exp $ */
/*
* Copyright (c) 2006 Dale Rahn <drahn@dalerahn.com>
*
@@ -625,7 +625,7 @@ elf_load_object(void *pexe, const char *name)
object->dyn.strtab = str;
strt = str;
- sym = malloc(object->nchains * sizeof(Elf_Sym));
+ sym = calloc(object->nchains, sizeof(Elf_Sym));
if (sym == NULL) {
printf("unable to allocate symtab for %s\n",
name);
@@ -1410,7 +1410,7 @@ void
elf_init_objarray(void)
{
objarray_sz = 512;
- objarray = xmalloc(sizeof (objarray[0]) * objarray_sz);
+ objarray = xcalloc(sizeof (objarray[0]), objarray_sz);
}
void