diff options
author | Simon Howard | 2014-03-29 21:49:57 -0400 |
---|---|---|
committer | Simon Howard | 2014-03-29 21:49:57 -0400 |
commit | eb3a4033c7d6f1d5e042edd5f416bbc257e40975 (patch) | |
tree | 9b6871a887655f88b4dbb1c5412469924604fb7e /src/strife/p_dialog.c | |
parent | 1e5e0a565cbcaf4f8aafa5a12c84e987aa822e13 (diff) | |
download | chocolate-doom-eb3a4033c7d6f1d5e042edd5f416bbc257e40975.tar.gz chocolate-doom-eb3a4033c7d6f1d5e042edd5f416bbc257e40975.tar.bz2 chocolate-doom-eb3a4033c7d6f1d5e042edd5f416bbc257e40975.zip |
strife: Eliminate use of unsafe string functions.
Eliminate use of strcpy, strcat, strncpy, and use the new safe
alternatives.
Diffstat (limited to 'src/strife/p_dialog.c')
-rw-r--r-- | src/strife/p_dialog.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/strife/p_dialog.c b/src/strife/p_dialog.c index 070288aa..95723a56 100644 --- a/src/strife/p_dialog.c +++ b/src/strife/p_dialog.c @@ -38,6 +38,7 @@ #include "doomstat.h"
#include "m_random.h"
#include "m_menu.h"
+#include "m_misc.h"
#include "r_main.h"
#include "v_video.h"
#include "p_local.h"
@@ -719,7 +720,7 @@ boolean P_GiveItemToPlayer(player_t *player, int sprnum, mobjtype_t type) {
if(mobjinfo[type].name)
{
- strncpy(pickupstring, DEH_String(mobjinfo[type].name), 39);
+ M_StringCopy(pickupstring, DEH_String(mobjinfo[type].name), 39);
player->message = pickupstring;
}
player->questflags |= 1 << (type - MT_TOKEN_QUEST1);
@@ -1132,10 +1133,9 @@ static void P_DialogDrawer(void) if(currentdialog->choices[i].needamounts[0] > 0)
{
// haleyjd 20120401: necessary to avoid undefined behavior:
- strcpy(choicetext2, choicetext);
+ M_StringCopy(choicetext2, choicetext, sizeof(choicetext2));
DEH_snprintf(choicetext, sizeof(choicetext),
- "%s for %d",
- choicetext2,
+ "%s for %d", choicetext2,
currentdialog->choices[i].needamounts[0]);
}
@@ -1228,7 +1228,7 @@ void P_DialogDoChoice(int choice) {
DEH_snprintf(mission_objective, OBJECTIVE_LEN, "log%i", objective);
objlump = W_CacheLumpName(mission_objective, PU_CACHE);
- strncpy(mission_objective, objlump, OBJECTIVE_LEN);
+ M_StringCopy(mission_objective, objlump, OBJECTIVE_LEN);
}
// haleyjd 20130301: v1.31 hack: if first char of message is a period,
// clear the player's message. Is this actually used anywhere?
|