diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2007-09-02 15:19:41 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2007-09-02 15:19:41 +0000 |
commit | 6ebd04219f0d749c87a763e8afb578dfcd5223cc (patch) | |
tree | bb0f29e0a3791fff88551c93f5d4ba7113bdba43 /usr.bin/spell | |
parent | be524287dc216d876f995eddcaf32762c702c6e9 (diff) |
use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg
Diffstat (limited to 'usr.bin/spell')
-rw-r--r-- | usr.bin/spell/spellprog.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/spell/spellprog.c b/usr.bin/spell/spellprog.c index 70aa381f9fb..5528cce8cdf 100644 --- a/usr.bin/spell/spellprog.c +++ b/usr.bin/spell/spellprog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spellprog.c,v 1.4 2003/06/03 02:56:16 millert Exp $ */ +/* $OpenBSD: spellprog.c,v 1.5 2007/09/02 15:19:34 deraadt Exp $ */ /* * Copyright (c) 1991, 1993 @@ -75,7 +75,7 @@ static const char copyright[] = static const char sccsid[] = "@(#)spell.c 8.1 (Berkeley) 6/6/93"; #else #endif -static const char rcsid[] = "$OpenBSD: spellprog.c,v 1.4 2003/06/03 02:56:16 millert Exp $"; +static const char rcsid[] = "$OpenBSD: spellprog.c,v 1.5 2007/09/02 15:19:34 deraadt Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -292,7 +292,7 @@ main(int argc, char **argv) usage(); /* Open and mmap the word/stop lists. */ - if ((wlists = malloc(sizeof(struct wlist) * (argc + 1))) == NULL) + if ((wlists = calloc(sizeof(struct wlist), (argc + 1))) == NULL) err(1, "malloc"); for (i = 0; argc--; i++) { wlists[i].fd = open(argv[i], O_RDONLY, 0); |