From 026dde5f4a975fbb18b32b880473f2dc042d56bd Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Wed, 15 Jun 2005 21:24:22 +0000 Subject: [PATCH] http://eressea.upb.de/mantis/view.php?id=561 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 --- src/common/kernel/battle.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/common/kernel/battle.c b/src/common/kernel/battle.c index 0a24ad685..4e8295ed4 100644 --- a/src/common/kernel/battle.c +++ b/src/common/kernel/battle.c @@ -3284,7 +3284,6 @@ battle_report(battle * b) side *s, *s2; boolean cont = false; boolean komma; - char * bufp = buf; bfaction *bf; buf[0] = 0; @@ -3305,6 +3304,7 @@ battle_report(battle * b) for (bf=b->factions;bf;bf=bf->next) { faction * fac = bf->faction; + char * bufp = buf; message * m; fbattlerecord(b, fac, " "); @@ -3332,9 +3332,14 @@ battle_report(battle * b) for (r=FIGHT_ROW;r!=NUMROWS;++r) { if (alive[r]) { - if (l!=FIGHT_ROW) scat("+"); - while(k--) scat("0+"); - icat(alive[r]); + if (l!=FIGHT_ROW) { + bufp += strlcpy(bufp, "+", sizeof(buf) - (bufp - buf)); + } + 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; l = r+1; } else ++k;