From ef972d8e764f3ff50b3964a5d5acb9f926f7f828 Mon Sep 17 00:00:00 2001 From: joey Date: Tue, 29 Aug 2000 00:23:15 +0000 Subject: [PATCH] * Patch from pmaydell@chiark.greenend.org.uk to fix a segfault in battlestar if you say "wear knfo" or similar nonsensical things. (Patch also sent upstream.) Closes: #70465 git-svn-id: file:///srv/svn/joey/bsdgames-trunk@5128 a4a2c43b-8ac3-0310-8836-e0e880c912e2 --- battlestar/com2.c | 20 +++++++++++++------- debian/changelog | 8 ++++++++ debian/control | 2 +- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/battlestar/com2.c b/battlestar/com2.c index 4128be1..ec9d269 100644 --- a/battlestar/com2.c +++ b/battlestar/com2.c @@ -1,4 +1,4 @@ -/* $NetBSD: com2.c,v 1.7 1998/08/24 00:22:45 hubertf Exp $ */ +/* $NetBSD: com2.c,v 1.8 1999/07/14 17:42:13 hubertf Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)com2.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: com2.c,v 1.7 1998/08/24 00:22:45 hubertf Exp $"); +__RCSID("$NetBSD: com2.c,v 1.8 1999/07/14 17:42:13 hubertf Exp $"); #endif #endif /* not lint */ @@ -54,12 +54,18 @@ wearit() while (wordtype[++wordnumber] == ADJS); while (wordnumber <= wordcount) { value = wordvalue[wordnumber]; - for (n = 0; objsht[value][n]; n++); - switch (value) { - - case -1: + /* Is the thing being worn a known object? */ + if (value == -1) { puts("Wear what?"); return (firstnumber); + } + /* Now find the length of the short description, + * mostly so we know if it ends in 's' or not. + */ + for (n = 0; objsht[value][n]; n++) + /* do nothing */; + + switch (value) { default: printf("You can't wear%s%s!\n", (objsht[value][n - 1] == 's' ? " " : " a "), objsht[value]); @@ -301,7 +307,7 @@ int follow() { if (followfight == ourtime) { - puts("The Dark Lord leaps away and runs down secret tunnels and corridoors."); + puts("The Dark Lord leaps away and runs down secret tunnels and corridors."); puts("You chase him through the darkness and splash in pools of water."); puts("You have cornered him. His laser sword extends as he steps forward."); position = FINAL; diff --git a/debian/changelog b/debian/changelog index 1792445..bfad239 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +bsdgames (2.11-2) unstable; urgency=low + + * Patch from pmaydell@chiark.greenend.org.uk to fix a segfault in + battlestar if you say "wear knfo" or similar nonsensical things. + (Patch also sent upstream.) Closes: #70465 + + -- Joey Hess Mon, 28 Aug 2000 17:16:27 -0700 + bsdgames (2.11-1) unstable; urgency=low * New upstream. diff --git a/debian/control b/debian/control index 7d03956..6c724dc 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: games Priority: optional Build-Depends: debhelper, libncurses5-dev, flex, bison, wenglish Maintainer: Joey Hess -Standards-Version: 3.1.1.1 +Standards-Version: 3.2.1.0 Package: bsdgames Architecture: any