summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/net_server.c17
-rw-r--r--src/w_checksum.c4
2 files changed, 9 insertions, 12 deletions
diff --git a/src/net_server.c b/src/net_server.c
index a2868370..c22d57e9 100644
--- a/src/net_server.c
+++ b/src/net_server.c
@@ -32,8 +32,8 @@
#include "d_mode.h"
#include "i_system.h"
#include "i_timer.h"
-
#include "m_argv.h"
+#include "m_misc.h"
#include "net_client.h"
#include "net_common.h"
@@ -427,15 +427,12 @@ static void NET_SV_SendWaitingData(net_client_t *client)
for (i = 0; i < wait_data.num_players; ++i)
{
- strncpy(wait_data.player_names[i],
- sv_players[i]->name,
- MAXPLAYERNAME);
- wait_data.player_names[i][MAXPLAYERNAME-1] = '\0';
-
- strncpy(wait_data.player_addrs[i],
- NET_AddrToString(sv_players[i]->addr),
- MAXPLAYERNAME);
- wait_data.player_addrs[i][MAXPLAYERNAME-1] = '\0';
+ M_StringCopy(wait_data.player_names[i],
+ sv_players[i]->name,
+ MAXPLAYERNAME);
+ M_StringCopy(wait_data.player_addrs[i],
+ NET_AddrToString(sv_players[i]->addr),
+ MAXPLAYERNAME);
}
// Construct packet:
diff --git a/src/w_checksum.c b/src/w_checksum.c
index 28451fda..c3a9a888 100644
--- a/src/w_checksum.c
+++ b/src/w_checksum.c
@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <string.h>
+#include "m_misc.h"
#include "sha1.h"
#include "w_checksum.h"
#include "w_wad.h"
@@ -64,8 +65,7 @@ static void ChecksumAddLump(sha1_context_t *sha1_context, lumpinfo_t *lump)
{
char buf[9];
- strncpy(buf, lump->name, 8);
- buf[8] = '\0';
+ M_StringCopy(buf, lump->name, sizeof(buf));
SHA1_UpdateString(sha1_context, buf);
SHA1_UpdateInt32(sha1_context, GetFileNumber(lump->wad_file));
SHA1_UpdateInt32(sha1_context, lump->position);