Kampf crasht mit Datenfile 420

Da waren 50 Armeen in einer Region, das hat einen string-buffer auf dem stack von battle_report gekillt.

followup-fix
This commit is contained in:
Enno Rehling 2005-06-15 21:24:22 +00:00
parent 475bd5a735
commit 026dde5f4a
1 changed files with 9 additions and 4 deletions

View File

@ -3284,7 +3284,6 @@ battle_report(battle * b)
side *s, *s2; side *s, *s2;
boolean cont = false; boolean cont = false;
boolean komma; boolean komma;
char * bufp = buf;
bfaction *bf; bfaction *bf;
buf[0] = 0; buf[0] = 0;
@ -3305,6 +3304,7 @@ battle_report(battle * b)
for (bf=b->factions;bf;bf=bf->next) { for (bf=b->factions;bf;bf=bf->next) {
faction * fac = bf->faction; faction * fac = bf->faction;
char * bufp = buf;
message * m; message * m;
fbattlerecord(b, fac, " "); fbattlerecord(b, fac, " ");
@ -3332,9 +3332,14 @@ battle_report(battle * b)
for (r=FIGHT_ROW;r!=NUMROWS;++r) { for (r=FIGHT_ROW;r!=NUMROWS;++r) {
if (alive[r]) { if (alive[r]) {
if (l!=FIGHT_ROW) scat("+"); if (l!=FIGHT_ROW) {
while(k--) scat("0+"); bufp += strlcpy(bufp, "+", sizeof(buf) - (bufp - buf));
icat(alive[r]); }
while (k--) {
bufp += strlcpy(bufp, "0+", sizeof(buf) - (bufp - buf));
}
sprintf(buffer, "%d", alive[r]);
bufp += strlcpy(bufp, buffer, sizeof(buf) - (bufp - buf));
k = 0; k = 0;
l = r+1; l = r+1;
} else ++k; } else ++k;