bugfix für read after alloc:

==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)
This commit is contained in:
Enno Rehling 2004-02-12 07:20:47 +00:00
parent b109a1d095
commit 71a87e1e7e
1 changed files with 1 additions and 0 deletions

View File

@ -3054,6 +3054,7 @@ simplename(region * r)
} }
if (isspace(c)) name[i] = '_'; if (isspace(c)) name[i] = '_';
else name[i] = *cp; else name[i] = *cp;
if (c==0) break;
} }
name[i]=0; name[i]=0;
return name; return name;