summaryrefslogtreecommitdiffstats
path: root/usr.bin/ftp/stringlist.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 /usr.bin/ftp/stringlist.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 'usr.bin/ftp/stringlist.c')
-rw-r--r--usr.bin/ftp/stringlist.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/ftp/stringlist.c b/usr.bin/ftp/stringlist.c
index 28bba57c8df..a0823e67af1 100644
--- a/usr.bin/ftp/stringlist.c
+++ b/usr.bin/ftp/stringlist.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: stringlist.c,v 1.7 2006/04/25 05:45:20 tedu Exp $ */
+/* $OpenBSD: stringlist.c,v 1.8 2007/09/02 15:19:32 deraadt Exp $ */
/* $NetBSD: stringlist.c,v 1.2 1997/01/17 07:26:20 lukem Exp $ */
/*
@@ -33,7 +33,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint) && !defined(SMALL)
-static const char rcsid[] = "$OpenBSD: stringlist.c,v 1.7 2006/04/25 05:45:20 tedu Exp $";
+static const char rcsid[] = "$OpenBSD: stringlist.c,v 1.8 2007/09/02 15:19:32 deraadt Exp $";
#endif /* LIBC_SCCS and not lint and not SMALL */
#include <stdio.h>
@@ -57,7 +57,7 @@ sl_init(void)
sl->sl_cur = 0;
sl->sl_max = _SL_CHUNKSIZE;
- sl->sl_str = malloc(sl->sl_max * sizeof(char *));
+ sl->sl_str = calloc(sl->sl_max, sizeof(char *));
if (sl->sl_str == NULL)
err(1, "stringlist");
return sl;