From 1e7908feb322f4ad8a88008964f1558861348ae6 Mon Sep 17 00:00:00 2001 From: James Haley Date: Mon, 2 Apr 2012 03:21:45 +0000 Subject: Fix to undefined sprintf behavior in the dialog engine (thanks to MP2E!). Other changes are to comments only. Subversion-branch: /branches/v2-branch Subversion-revision: 2509 --- src/strife/p_dialog.c | 5 ++++- src/strife/p_inter.c | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/strife/p_dialog.c b/src/strife/p_dialog.c index 0fa31854..ecb11d25 100644 --- a/src/strife/p_dialog.c +++ b/src/strife/p_dialog.c @@ -1057,6 +1057,7 @@ static void P_DialogDrawer(void) int height; int finaly; char choicetext[64]; + char choicetext2[64]; // Run down bonuscount faster than usual so that flashes from being given // items are less obvious. @@ -1130,9 +1131,11 @@ static void P_DialogDrawer(void) // alternate text for items that need money if(currentdialog->choices[i].needamounts[0] > 0) { + // haleyjd 20120401: necessary to avoid undefined behavior: + strcpy(choicetext2, choicetext); DEH_snprintf(choicetext, sizeof(choicetext), "%s for %d", - choicetext, + choicetext2, currentdialog->choices[i].needamounts[0]); } diff --git a/src/strife/p_inter.c b/src/strife/p_inter.c index 4a7a173d..9bedd78c 100644 --- a/src/strife/p_inter.c +++ b/src/strife/p_inter.c @@ -260,7 +260,6 @@ boolean P_GiveBody(player_t* player, int num) // Set mo->health for consistency. // haleyjd 20110225: Seems Strife can call this on a NULL player->mo // when giving items to players that are not in the game... - // STRIFE-FIXME: needs major verification! mo = P_SubstNullMobj(player->mo); mo->health = player->health; } @@ -287,7 +286,7 @@ boolean P_GiveBody(player_t* player, int num) if(player->health >= healing) return false; - // Set health. Oddly, mo->health is NOT set here... + // Set health. BUG: Oddly, mo->health is NOT set here... player->health = healing; } -- cgit v1.2.3