From 71a87e1e7eb210df8b3a96039d25e36267efb308 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Thu, 12 Feb 2004 07:20:47 +0000 Subject: [PATCH] =?UTF-8?q?bugfix=20f=C3=BCr=20read=20after=20alloc:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ==12779== ==12779== Invalid read of size 1 ==12779== at 0x807C3B2: simplename (common/kernel/battle.c:3049) ==12779== by 0x807C43D: make_battle (common/kernel/battle.c:3083) ==12779== by 0x807D236: do_battle (common/kernel/battle.c:3537) ==12779== by 0x80C9706: processorders (common/gamecode/laws.c:3556) ==12779== Address 0x45D84EB5 is 0 bytes after a block of size 13 alloc'd ==12779== at 0x40028A89: malloc (vg_replace_malloc.c:153) ==12779== by 0x40029038: realloc (vg_replace_malloc.c:302) ==12779== by 0x809D3C5: rds (common/kernel/save.c:265) ==12779== by 0x80A00C0: readregion (common/kernel/save.c:1832) --- src/common/kernel/battle.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common/kernel/battle.c b/src/common/kernel/battle.c index b0604bc9c..fea1d80a8 100644 --- a/src/common/kernel/battle.c +++ b/src/common/kernel/battle.c @@ -3054,6 +3054,7 @@ simplename(region * r) } if (isspace(c)) name[i] = '_'; else name[i] = *cp; + if (c==0) break; } name[i]=0; return name;