Subject: bin/6142: [PATCH] number(6) bug fix
To: None <gnats-bugs@gnats.netbsd.org>
From: Joseph Myers <jsm@octomino.demon.co.uk>
List: netbsd-bugs
Date: 09/11/1998 19:26:30
>Number:         6142
>Category:       bin
>Synopsis:       [PATCH] number(6) bug fix
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 11 12:35:00 1998
>Last-Modified:
>Originator:     Joseph Samuel Myers
>Organization:
Trinity College, University of Cambridge, UK
>Release:        NetBSD-current of 1998-08-30
>Environment:
[
System: Linux octomino 2.0.35 #1 Wed Aug 12 15:54:21 UTC 1998 i586 unknown
Architecture: i586
]
>Description:

The game number(6) has a bug in its handling of negative numbers: when
the minus sign is skipped, the recorded length of the number should be
decremented but isn't.

>How-To-Repeat:

number -- -0.1 (segfaults, at least with the Linux port against which
this was reported as a bug).

>Fix:

diff -ruN number/number.c number+/number.c
--- number/number.c	Sat Oct 11 11:53:31 1997
+++ number+/number.c	Fri Sep 11 19:20:27 1998
@@ -173,6 +173,7 @@
 	if (*line == '-') {
 		(void)printf("minus%s", lflag ? " " : "\n");
 		++line;
+		--len;
 	}
 
 	rval = len > 0 ? unit(len, line) : 0;
>Audit-Trail:
>Unformatted: