diff options
author | 2007-09-02 15:19:07 +0000 | |
---|---|---|
committer | 2007-09-02 15:19:07 +0000 | |
commit | 1ed98fdf61d9dd29369f246109081408082ce54d (patch) | |
tree | ad7631e58c83830d1fc51cbadb9a2da53c1abfb7 /usr.bin/awk/lib.c | |
parent | OpenCVS server init-support with OpenCVS and GNU cvs clients. (diff) | |
download | wireguard-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/awk/lib.c')
-rw-r--r-- | usr.bin/awk/lib.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/awk/lib.c b/usr.bin/awk/lib.c index a9204a1ee01..4ec822f7c6d 100644 --- a/usr.bin/awk/lib.c +++ b/usr.bin/awk/lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib.c,v 1.16 2005/11/23 02:43:45 millert Exp $ */ +/* $OpenBSD: lib.c,v 1.17 2007/09/02 15:19:31 deraadt Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -61,7 +61,7 @@ void recinit(unsigned int n) { record = (char *) malloc(n); fields = (char *) malloc(n); - fldtab = (Cell **) malloc((nfields+1) * sizeof(Cell *)); + fldtab = (Cell **) calloc((nfields+1), sizeof(Cell *)); if (record == NULL || fields == NULL || fldtab == NULL) FATAL("out of space for $0 and fields"); |