diff options
author | roam <roam@FreeBSD.org> | 2002-04-15 17:27:34 +0000 |
---|---|---|
committer | roam <roam@FreeBSD.org> | 2002-04-15 17:27:34 +0000 |
commit | 5f4f4e1cd64c7ceb0360dad7ebf2263238b35102 (patch) | |
tree | 010b4f5901b54e51af23719bd9fe681c656d37c6 /games/battlestar | |
parent | d5c513e81bcc8e880cbb2be2c9e601da98893fd0 (diff) | |
download | FreeBSD-src-5f4f4e1cd64c7ceb0360dad7ebf2263238b35102.zip FreeBSD-src-5f4f4e1cd64c7ceb0360dad7ebf2263238b35102.tar.gz |
Fix a segfault if 'wear' is used without an argument or with
an argument that is not a valid word from the battlestar dictionary.
PR: 36992
Submitted by: Ceri Davies <ceri@FreeBSD.org>
Reviewed by: dd
Approved by: dd, silence on -audit
MFC after: 2 weeks
Diffstat (limited to 'games/battlestar')
-rw-r--r-- | games/battlestar/com2.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/games/battlestar/com2.c b/games/battlestar/com2.c index f8b0f38..d41d6037 100644 --- a/games/battlestar/com2.c +++ b/games/battlestar/com2.c @@ -51,13 +51,12 @@ wearit() /* synonyms = {sheathe, sheath} */ while(wordtype[++wordnumber] == ADJS); while(wordnumber <= wordcount){ value = wordvalue[wordnumber]; + if (value == -1) { + puts("Wear what?"); + return (firstnumber); + } for (n=0; objsht[value][n]; n++); switch(value){ - - case -1: - puts("Wear what?"); - return(firstnumber); - default: printf("You can't wear%s%s!\n",(objsht[value][n-1] == 's' ? " " : " a "),objsht[value]); return(firstnumber); |