diff --git a/src/netcode/protocol.h b/src/netcode/protocol.h index 4b39fab664995c4e171b95a38b776a8b4df1ea4f..058254a9084bf377133d0de2432046d05e3d6efd 100644 --- a/src/netcode/protocol.h +++ b/src/netcode/protocol.h @@ -26,7 +26,7 @@ packet versions. If you change the struct or the meaning of a field therein, increment this number. */ -#define PACKETVERSION 5 +#define PACKETVERSION 6 // Network play related stuff. // There is a data struct that stores network @@ -226,7 +226,7 @@ typedef struct tic_t time; tic_t leveltime; char servername[MAXSERVERNAME]; - char mapname[8]; + char mapname[24]; char maptitle[33]; unsigned char mapmd5[16]; UINT8 actnum; diff --git a/src/netcode/server_connection.c b/src/netcode/server_connection.c index ef7f7e519a88ef344ac385fe7cae70976a014176..616bdbfbaf8286544646a100066d548c2dae3d83 100644 --- a/src/netcode/server_connection.c +++ b/src/netcode/server_connection.c @@ -114,15 +114,15 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime) netbuffer->u.serverinfo.refusereason = GetRefuseReason(node); - strncpy(netbuffer->u.serverinfo.gametypename, Gametype_Names[gametype], + strlcpy(netbuffer->u.serverinfo.gametypename, Gametype_Names[gametype], sizeof netbuffer->u.serverinfo.gametypename); netbuffer->u.serverinfo.modifiedgame = (UINT8)modifiedgame; netbuffer->u.serverinfo.cheatsenabled = CV_CheatsEnabled(); netbuffer->u.serverinfo.flags = (dedicated ? SV_DEDICATED : 0); - strncpy(netbuffer->u.serverinfo.servername, cv_servername.string, + strlcpy(netbuffer->u.serverinfo.servername, cv_servername.string, MAXSERVERNAME); - strncpy(netbuffer->u.serverinfo.mapname, G_BuildMapName(gamemap), 7); // [mapnames] FIXME + strlcpy(netbuffer->u.serverinfo.mapname, G_BuildMapName(gamemap), sizeof netbuffer->u.serverinfo.mapname); M_Memcpy(netbuffer->u.serverinfo.mapmd5, mapmd5, 16); memset(netbuffer->u.serverinfo.maptitle, 0, sizeof netbuffer->u.serverinfo.maptitle); @@ -142,7 +142,6 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime) read++; } *writ = '\0'; - //strncpy(netbuffer->u.serverinfo.maptitle, (char *)mapheaderinfo[gamemap-1]->lvlttl, 33); } else strncpy(netbuffer->u.serverinfo.maptitle, "UNKNOWN", 32);