summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/getnetgrent.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2007-09-02 15:19:07 +0000
committerderaadt <deraadt@openbsd.org>2007-09-02 15:19:07 +0000
commit1ed98fdf61d9dd29369f246109081408082ce54d (patch)
treead7631e58c83830d1fc51cbadb9a2da53c1abfb7 /lib/libc/gen/getnetgrent.c
parentOpenCVS server init-support with OpenCVS and GNU cvs clients. (diff)
downloadwireguard-openbsd-1ed98fdf61d9dd29369f246109081408082ce54d.tar.xz
wireguard-openbsd-1ed98fdf61d9dd29369f246109081408082ce54d.zip
use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg
Diffstat (limited to 'lib/libc/gen/getnetgrent.c')
-rw-r--r--lib/libc/gen/getnetgrent.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/gen/getnetgrent.c b/lib/libc/gen/getnetgrent.c
index 51493ed422c..937ce158d1e 100644
--- a/lib/libc/gen/getnetgrent.c
+++ b/lib/libc/gen/getnetgrent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getnetgrent.c,v 1.18 2007/03/05 20:29:14 millert Exp $ */
+/* $OpenBSD: getnetgrent.c,v 1.19 2007/09/02 15:19:16 deraadt Exp $ */
/*
* Copyright (c) 1994 Christos Zoulas
@@ -88,7 +88,7 @@ _ng_sl_init(void)
sl->sl_cur = 0;
sl->sl_max = 20;
- sl->sl_str = malloc(sl->sl_max * sizeof(char *));
+ sl->sl_str = calloc(sl->sl_max, sizeof(char *));
if (sl->sl_str == NULL)
return NULL;
return sl;