mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-21 09:13:37 +00:00
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
c58d96bb2f
commit
7664eb8fc2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=94784
|
@ -51,13 +51,12 @@ wearit() /* synonyms = {sheathe, sheath} */
|
||||||
while(wordtype[++wordnumber] == ADJS);
|
while(wordtype[++wordnumber] == ADJS);
|
||||||
while(wordnumber <= wordcount){
|
while(wordnumber <= wordcount){
|
||||||
value = wordvalue[wordnumber];
|
value = wordvalue[wordnumber];
|
||||||
|
if (value == -1) {
|
||||||
|
puts("Wear what?");
|
||||||
|
return (firstnumber);
|
||||||
|
}
|
||||||
for (n=0; objsht[value][n]; n++);
|
for (n=0; objsht[value][n]; n++);
|
||||||
switch(value){
|
switch(value){
|
||||||
|
|
||||||
case -1:
|
|
||||||
puts("Wear what?");
|
|
||||||
return(firstnumber);
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf("You can't wear%s%s!\n",(objsht[value][n-1] == 's' ? " " : " a "),objsht[value]);
|
printf("You can't wear%s%s!\n",(objsht[value][n-1] == 's' ? " " : " a "),objsht[value]);
|
||||||
return(firstnumber);
|
return(firstnumber);
|
||||||
|
|
Loading…
Reference in a new issue