foxygit / doom Log in
commit 1e7908feb322f4ad8a88008964f1558861348ae6
Author:     James Haley <haleyjd@hotmail.com>
AuthorDate: Mon Apr 2 03:21:45 2012 +0000
Commit:     James Haley <haleyjd@hotmail.com>
CommitDate: Mon Apr 2 03:21:45 2012 +0000

    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;
     }