foxygit / doom Log in
commit 6787e90da50f6954d80512d172a985af4a6fc299
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Sat May 1 21:47:26 2010 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Sat May 1 21:47:26 2010 +0000

    Further sanity checking on use of strcpy() with dehacked string
    replacements.

    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 1928
---
 src/net_client.c | 3 ++-
 src/wi_stuff.c   | 6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/net_client.c b/src/net_client.c
index 0d6dd2fc..322869d7 100644
--- a/src/net_client.c
+++ b/src/net_client.c
@@ -193,7 +193,8 @@ static void NET_CL_PlayerQuitGame(player_t *player)
     // Do this the same way as Vanilla Doom does, to allow dehacked
     // replacements of this message

-    strcpy(exitmsg, DEH_String("Player 1 left the game"));
+    strncpy(exitmsg, DEH_String("Player 1 left the game"), sizeof(exitmsg));
+    exitmsg[sizeof(exitmsg) - 1] = '\0';

     exitmsg[7] += player - players;

diff --git a/src/wi_stuff.c b/src/wi_stuff.c
index e7eece07..e8fcab42 100644
--- a/src/wi_stuff.c
+++ b/src/wi_stuff.c
@@ -1749,11 +1749,13 @@ void WI_loadData(void)

     if (gamemode == commercial)
     {
-	strcpy(bg_lumpname, DEH_String("INTERPIC"));
+	strncpy(bg_lumpname, 9, DEH_String("INTERPIC"));
+        bg_lumpname[8] = '\0';
     }
     else if (gamemode == retail && wbs->epsd == 3)
     {
-	strcpy(bg_lumpname, DEH_String("INTERPIC"));
+	strncpy(bg_lumpname, 9, DEH_String("INTERPIC"));
+        bg_lumpname[8] = '\0';
     }
     else
     {