setsector: Clean up read beyond end of string

setsector() reads the first two characters unconditionally.  Wrong if
the first character is NUL.  The second character read isn't actually
used then.  Screwed up in Chainsaw.

When getstarg() returns an empty string, it's always in the buffer
passed as third argument.  Thus, reading the second character is
actually safe.

Clean it up anyway.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2013-01-24 22:01:45 +01:00
parent a922cc9c5f
commit d4e9dccbcc

View file

@ -56,7 +56,7 @@ setsector(void)
what = getstarg(player->argp[1], what = getstarg(player->argp[1],
"Give what (iron, gold, oil, uranium, fertility, owner, eff., mob., work, avail., oldown, mines)? ", "Give what (iron, gold, oil, uranium, fertility, owner, eff., mob., work, avail., oldown, mines)? ",
buf); buf);
if (!what) if (!what || !*what)
return RET_SYN; return RET_SYN;
char0 = what[0]; char0 = what[0];
char1 = what[1]; char1 = what[1];