Source-Changes-HG archive

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

[src/netbsd-2]: src/games/banner Pull up following revision(s) (requested by ...



details:   https://anonhg.NetBSD.org/src/rev/986dd030fa78
branches:  netbsd-2
changeset: 564564:986dd030fa78
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Fri Nov 24 21:18:15 2006 +0000

description:
Pull up following revision(s) (requested by reed in ticket #10764):
        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 710e1325fd0a -r 986dd030fa78 games/banner/banner.c
--- a/games/banner/banner.c     Tue Nov 21 09:43:08 2006 +0000
+++ b/games/banner/banner.c     Fri Nov 24 21:18:15 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.4.1 2006/11/24 21:18:15 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.4.1 2006/11/24 21:18:15 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