From 40566e69263ffec3ba641979286829dd721c9cf7 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 25 May 2020 21:27:48 +0100 Subject: [PATCH] Got_AddPlayer: check that I_GetNodeAddress(node) is non-NULL before using strcpy to copy it to the playeraddress array --- src/d_clisrv.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index ed0b8e528..0892607b6 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3291,7 +3291,6 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) boolean splitscreenplayer; boolean rejoined; player_t *newplayer; - char *port; if (playernum != serverplayer && !IsPlayerAdmin(playernum)) { @@ -3322,10 +3321,15 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) if (server && I_GetNodeAddress) { - strcpy(playeraddress[newplayernum], I_GetNodeAddress(node)); - port = strchr(playeraddress[newplayernum], ':'); - if (port) - *port = '\0'; + const char *address = I_GetNodeAddress(node); + char *port = NULL; + if (address) // MI: fix msvcrt.dll!_mbscat crash? + { + strcpy(playeraddress[newplayernum], address); + port = strchr(playeraddress[newplayernum], ':'); + if (port) + *port = '\0'; + } } }