summaryrefslogtreecommitdiffstats
path: root/usr.bin/window/wwopen.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/window/wwopen.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/window/wwopen.c')
-rw-r--r--usr.bin/window/wwopen.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/window/wwopen.c b/usr.bin/window/wwopen.c
index 804da4a96c0..c10f39191b9 100644
--- a/usr.bin/window/wwopen.c
+++ b/usr.bin/window/wwopen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wwopen.c,v 1.10 2003/07/10 00:06:52 david Exp $ */
+/* $OpenBSD: wwopen.c,v 1.11 2007/09/02 15:19:35 deraadt Exp $ */
/* $NetBSD: wwopen.c,v 1.6 1996/02/08 21:08:04 mycroft Exp $ */
/*
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)wwopen.c 8.2 (Berkeley) 4/28/95";
#else
-static char rcsid[] = "$OpenBSD: wwopen.c,v 1.10 2003/07/10 00:06:52 david Exp $";
+static char rcsid[] = "$OpenBSD: wwopen.c,v 1.11 2007/09/02 15:19:35 deraadt Exp $";
#endif
#endif /* not lint */
@@ -165,7 +165,7 @@ wwopen(type, oflags, nrow, ncol, row, col, nline)
for (j = w->ww_b.l; j < w->ww_b.r; j++)
w->ww_buf[i][j].c_w = ' ';
- w->ww_nvis = (short *)malloc(w->ww_w.nr * sizeof (short));
+ w->ww_nvis = (short *)calloc(w->ww_w.nr, sizeof (short));
if (w->ww_nvis == 0) {
wwerrno = WWE_NOMEM;
goto bad;