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
This commit is contained in:
parent
d5c513e81b
commit
5f4f4e1cd6
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user