From d4e9dccbccde51c83476c6600752b69974384957 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Thu, 24 Jan 2013 22:01:45 +0100 Subject: [PATCH] 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 --- src/lib/commands/setsect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/commands/setsect.c b/src/lib/commands/setsect.c index c1490ab30..afbff7a49 100644 --- a/src/lib/commands/setsect.c +++ b/src/lib/commands/setsect.c @@ -56,7 +56,7 @@ setsector(void) what = getstarg(player->argp[1], "Give what (iron, gold, oil, uranium, fertility, owner, eff., mob., work, avail., oldown, mines)? ", buf); - if (!what) + if (!what || !*what) return RET_SYN; char0 = what[0]; char1 = what[1]; -- 2.43.0