Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-3-0]: src/games/banner Pull up following revision(s) (requested b...



details:   https://anonhg.NetBSD.org/src/rev/70fe6c513249
branches:  netbsd-3-0
changeset: 579350:70fe6c513249
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Fri Nov 24 21:39:02 2006 +0000

description:
Pull up following revision(s) (requested by reed in ticket #1591):
        games/banner/banner.c: revision 1.16 via patch
Check that -w width is not above maximum. (It already checks for zero or
negative.) Using width above DWIDTH may cause overflow as noted by Gruzicki
Wlodek on bugtraq.
While here replace one use of 132 with DWIDTH.

diffstat:

 games/banner/banner.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 5b3323109c25 -r 70fe6c513249 games/banner/banner.c
--- a/games/banner/banner.c     Mon Nov 20 14:57:05 2006 +0000
+++ b/games/banner/banner.c     Fri Nov 24 21:39:02 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: banner.c,v 1.12 2004/01/27 20:30:28 jsm Exp $  */
+/*     $NetBSD: banner.c,v 1.12.10.1 2006/11/24 21:39:02 bouyer Exp $  */
 
 /*
  * Copyright (c) 1980, 1993, 1994
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)banner.c   8.4 (Berkeley) 4/29/95";
 #else
-__RCSID("$NetBSD: banner.c,v 1.12 2004/01/27 20:30:28 jsm Exp $");
+__RCSID("$NetBSD: banner.c,v 1.12.10.1 2006/11/24 21:39:02 bouyer Exp $");
 #endif
 #endif /* not lint */
 
@@ -1045,7 +1045,7 @@
                        break;
                case 'w':
                        width = atoi(optarg);
-                       if (width <= 0)
+                       if (width <= 0 || width > DWIDTH)
                                errx(1, "illegal argument for -w option");
                        break;
                case '?':
@@ -1057,7 +1057,7 @@
        argv += optind;
 
        for (i = 0; i < width; i++) {
-               j = i * 132 / width;
+               j = i * DWIDTH / width;
                print[j] = 1;
        }
 



Home | Main Index | Thread Index | Old Index