summaryrefslogtreecommitdiff
path: root/games/banner
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2006-11-22 19:31:40 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2006-11-22 19:31:40 +0000
commit49a70c823f16381dfd925eb5b6948ebb1f9c78b0 (patch)
treefcae33aa7e12230c35e8df7c2676ba15940b9eda /games/banner
parentf11b2023729bf4e59e9c1ddefc17af4529a40dbf (diff)
Fix an int overflow, reported on bugtraq by Gruzicki Wlodek; ok millert@
Diffstat (limited to 'games/banner')
-rw-r--r--games/banner/banner.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/games/banner/banner.c b/games/banner/banner.c
index d2a0b39c159..7f9069a696e 100644
--- a/games/banner/banner.c
+++ b/games/banner/banner.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: banner.c,v 1.12 2004/07/09 15:59:26 deraadt Exp $ */
+/* $OpenBSD: banner.c,v 1.13 2006/11/22 19:31:39 otto Exp $ */
/* $NetBSD: banner.c,v 1.4 1995/04/22 11:55:15 cgd Exp $ */
/*
@@ -40,7 +40,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)banner.c 8.3 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: banner.c,v 1.12 2004/07/09 15:59:26 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: banner.c,v 1.13 2006/11/22 19:31:39 otto Exp $";
#endif
#endif /* not lint */
@@ -1041,7 +1041,7 @@ main(int argc, char *argv[])
break;
case 'w':
width = atoi(optarg);
- if (width <= 0)
+ if (width <= 0 || width > DWIDTH)
errx(1, "illegal argument for -w option");
break;
case '?': case 'h':
@@ -1053,7 +1053,7 @@ main(int argc, char *argv[])
argv += optind;
for (i = 0; i < width; i++) {
- j = i * 132 / width;
+ j = i * DWIDTH / width;
print[j] = 1;
}