Subject: bin/6006: [PATCH] Battlestar bug fix 3
To: None <gnats-bugs@gnats.netbsd.org>
From: Joseph Myers <jsm@octomino.demon.co.uk>
List: netbsd-bugs
Date: 08/23/1998 18:57:00
>Number: 6006
>Category: bin
>Synopsis: [PATCH] Battlestar bug fix 3
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Aug 23 12:05:01 1998
>Last-Modified:
>Originator: Joseph Samuel Myers
>Organization:
Trinity College, University of Cambridge, UK
>Release: NetBSD-current of 1998-08-19
>Environment:
[
System: Linux octomino 2.0.35 #1 Wed Aug 12 15:54:21 UTC 1998 i586 unknown
Architecture: i586
]
>Description:
The games battlestar indicates certain special "objects", that should
not be included in "take all" and similar, by a NULL pointer in the
objsht[] array (globals.c); but the function cypher() checks for an
empty string instead, causing segfaults when you try to use ALL in a
location with such an "object".
>How-To-Repeat:
>Fix:
diff -ruN battlestar/cypher.c battlestar+3/cypher.c
--- battlestar/cypher.c Sat Oct 11 11:50:14 1997
+++ battlestar+3/cypher.c Sun Aug 23 18:34:59 1998
@@ -103,7 +103,7 @@
case SHOOT:
if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
for (n = 0; n < NUMOFOBJECTS; n++)
- if (testbit(location[position].objects, n) && *objsht[n]) {
+ if (testbit(location[position].objects, n) && objsht[n]) {
wordvalue[wordnumber + 1] = n;
wordnumber = shoot();
}
@@ -116,7 +116,7 @@
case TAKE:
if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
for (n = 0; n < NUMOFOBJECTS; n++)
- if (testbit(location[position].objects, n) && *objsht[n]) {
+ if (testbit(location[position].objects, n) && objsht[n]) {
wordvalue[wordnumber + 1] = n;
wordnumber = take(location[position].objects);
}
@@ -146,7 +146,7 @@
if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
for (n = 0; n < NUMOFOBJECTS; n++)
if (testbit(inven, n) ||
- (testbit(location[position].objects, n) && *objsht[n])) {
+ (testbit(location[position].objects, n) && objsht[n])) {
wordvalue[wordnumber + 1] = n;
wordnumber = throw(wordvalue[wordnumber] == KICK ? "Kicked" : "Thrown");
}
@@ -186,7 +186,7 @@
if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
for (n = 0; n < NUMOFOBJECTS; n++)
- if (testbit(location[position].objects, n) && *objsht[n]) {
+ if (testbit(location[position].objects, n) && objsht[n]) {
wordvalue[wordnumber + 1] = n;
wordnumber = puton();
}
>Audit-Trail:
>Unformatted: