diff options
author | jsm <jsm@NetBSD.org> | 2000-09-21 10:38:50 +0000 |
---|---|---|
committer | jsm <jsm@NetBSD.org> | 2000-09-21 10:38:50 +0000 |
commit | 66bc28438e19fafc7abecfa76bce72d10174c9be (patch) | |
tree | 523021ac4990c17463f61fb85b9e9c650689f2cb /battlestar | |
parent | 9b155f6c698343b8b24b5dff54920f74ae4bbf6c (diff) | |
download | bsdgames-darwin-66bc28438e19fafc7abecfa76bce72d10174c9be.tar.gz bsdgames-darwin-66bc28438e19fafc7abecfa76bce72d10174c9be.tar.zst bsdgames-darwin-66bc28438e19fafc7abecfa76bce72d10174c9be.zip |
Don't try to wear anything that isn't OBJECT or NOUNS. Don't try to
wear DOOR or anything without a short description. Fixes crashes on
"wear knfo" (bug reported by Peter Maydell
<pmaydell@chiark.greenend.org.uk>), "wear wear", "wear kick", "wear
door" and "wear goddess". Partly from OpenBSD.
Diffstat (limited to 'battlestar')
-rw-r--r-- | battlestar/com2.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/battlestar/com2.c b/battlestar/com2.c index 98cee5c2..634d4e3d 100644 --- a/battlestar/com2.c +++ b/battlestar/com2.c @@ -1,4 +1,4 @@ -/* $NetBSD: com2.c,v 1.11 2000/09/21 10:22:36 jsm Exp $ */ +/* $NetBSD: com2.c,v 1.12 2000/09/21 10:38:50 jsm 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.11 2000/09/21 10:22:36 jsm Exp $"); +__RCSID("$NetBSD: com2.c,v 1.12 2000/09/21 10:38:50 jsm Exp $"); #endif #endif /* not lint */ @@ -52,8 +52,11 @@ wearit() firstnumber = wordnumber; while (wordtype[++wordnumber] == ADJS); - while (wordnumber <= wordcount) { + while (wordnumber <= wordcount && (wordtype[wordnumber] == OBJECT || + wordtype[wordnumber] == NOUNS) && wordvalue[wordnumber] != DOOR) { value = wordvalue[wordnumber]; + if (objsht[value] == NULL) + break; for (n = 0; objsht[value][n]; n++); switch (value) { |