try fixing some crash with bogus netxcmds

This commit is contained in:
Alug committed 2025-05-23 16:55:47 +02:00
1 parent c3458afe2b
commit f87bcef079
1 file changed
+9 -2
+9 -2
View File
@@ -5696,13 +5696,20 @@ static void HandlePacketFromPlayer(SINT8 node)
// copy the textcmds
numtxtpak = *txtpak++;
for (j = 0; j < numtxtpak; j++)
{
INT32 k = *txtpak++; // playernum
INT32 playernum = *txtpak++; // playernum
const size_t txtsize = txtpak[0]+1;
if (playernum < 0 || playernum >= MAXPLAYERS)
{
CONS_Alert(CONS_WARNING, "Got bogus NetXCmd packet targetting player %d\n", playernum);
return;
}
if (i >= gametic) // Don't copy old net commands
M_Memcpy(D_GetTextcmd(i, k), txtpak, txtsize);
M_Memcpy(D_GetTextcmd(i, playernum), txtpak, txtsize);
txtpak += txtsize;
}
}