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/rs | |
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/rs')
-rw-r--r-- | usr.bin/rs/rs.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/rs/rs.c b/usr.bin/rs/rs.c index f3524bc0624..bd0fffc33c1 100644 --- a/usr.bin/rs/rs.c +++ b/usr.bin/rs/rs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rs.c,v 1.17 2006/04/17 09:45:00 moritz Exp $ */ +/* $OpenBSD: rs.c,v 1.18 2007/09/02 15:19:34 deraadt Exp $ */ /*- * Copyright (c) 1993 @@ -39,7 +39,7 @@ static const char copyright[] = #if 0 static const char sccsid[] = "@(#)rs.c 8.1 (Berkeley) 6/6/93"; #else -static const char rcsid[] = "$OpenBSD: rs.c,v 1.17 2006/04/17 09:45:00 moritz Exp $"; +static const char rcsid[] = "$OpenBSD: rs.c,v 1.18 2007/09/02 15:19:34 deraadt Exp $"; #endif #endif /* not lint */ @@ -281,7 +281,7 @@ prepfile(void) *ep = *(ep - nelem); nelem = lp - elem; } - if (!(colwidths = (short *) malloc(ocols * sizeof(short)))) + if (!(colwidths = (short *) calloc(ocols, sizeof(short)))) errx(1, "malloc: No gutter space"); if (flags & SQUEEZE) { if (flags & TRANSPOSE) |