mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-17 13:32:38 +00:00
Don't sigcheck game traffic if you're not the server, you can't do anything with it
This commit is contained in:
parent
ca767a554b
commit
a1b0625f66
1 changed files with 33 additions and 30 deletions
|
|
@ -4689,42 +4689,45 @@ static void HandlePacketFromPlayer(SINT8 node)
|
||||||
I_Error("bad table nodetoplayer: node %d player %d", doomcom->remotenode, netconsole);
|
I_Error("bad table nodetoplayer: node %d player %d", doomcom->remotenode, netconsole);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t allzero[32];
|
if (server)
|
||||||
memset(allzero, 0, sizeof(allzero));
|
|
||||||
|
|
||||||
int splitnodes;
|
|
||||||
if (IsPacketSigned(netbuffer->packettype))
|
|
||||||
{
|
{
|
||||||
for (splitnodes = 0; splitnodes < MAXSPLITSCREENPLAYERS; splitnodes++)
|
uint8_t allzero[32];
|
||||||
{
|
memset(allzero, 0, sizeof(allzero));
|
||||||
// Don't try to enforce signatures for players that aren't present.
|
|
||||||
if (splitnodes > 0 && nodetoplayer2[node] <= 0)
|
|
||||||
break;
|
|
||||||
if (splitnodes > 1 && nodetoplayer3[node] <= 0)
|
|
||||||
break;
|
|
||||||
if (splitnodes > 2 && nodetoplayer4[node] <= 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
const void* message = &netbuffer->u;
|
int splitnodes;
|
||||||
if (memcmp(allzero, lastReceivedKey[node][splitnodes], sizeof(allzero)) == 0)
|
if (IsPacketSigned(netbuffer->packettype))
|
||||||
|
{
|
||||||
|
for (splitnodes = 0; splitnodes < MAXSPLITSCREENPLAYERS; splitnodes++)
|
||||||
{
|
{
|
||||||
//CONS_Printf("Throwing out a guest signature from node %d player %d\n", node, splitnodes);
|
// Don't try to enforce signatures for players that aren't present.
|
||||||
}
|
if (splitnodes > 0 && nodetoplayer2[node] <= 0)
|
||||||
else
|
break;
|
||||||
{
|
if (splitnodes > 1 && nodetoplayer3[node] <= 0)
|
||||||
if (crypto_eddsa_check(netbuffer->signature[splitnodes], lastReceivedKey[node][splitnodes], message, doomcom->datalength - BASEPACKETSIZE))
|
break;
|
||||||
|
if (splitnodes > 2 && nodetoplayer4[node] <= 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
const void* message = &netbuffer->u;
|
||||||
|
if (memcmp(allzero, lastReceivedKey[node][splitnodes], sizeof(allzero)) == 0)
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_ERROR, "SIGFAIL! Packet type %d from node %d player %d\nkey %s size %d netconsole %d\n",
|
//CONS_Printf("Throwing out a guest signature from node %d player %d\n", node, splitnodes);
|
||||||
netbuffer->packettype, node, splitnodes,
|
|
||||||
GetPrettyRRID(lastReceivedKey[node][splitnodes], true), doomcom->datalength - BASEPACKETSIZE, netconsole);
|
|
||||||
if (netconsole != -1) // NO IDEA.
|
|
||||||
SendKick(netconsole, KICK_MSG_SIGFAIL);
|
|
||||||
// Net_CloseConnection(node);
|
|
||||||
// nodeingame[node] = false;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (crypto_eddsa_check(netbuffer->signature[splitnodes], lastReceivedKey[node][splitnodes], message, doomcom->datalength - BASEPACKETSIZE))
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_ERROR, "SIGFAIL! Packet type %d from node %d player %d\nkey %s size %d netconsole %d\n",
|
||||||
|
netbuffer->packettype, node, splitnodes,
|
||||||
|
GetPrettyRRID(lastReceivedKey[node][splitnodes], true), doomcom->datalength - BASEPACKETSIZE, netconsole);
|
||||||
|
if (netconsole != -1) // NO IDEA.
|
||||||
|
SendKick(netconsole, KICK_MSG_SIGFAIL);
|
||||||
|
// Net_CloseConnection(node);
|
||||||
|
// nodeingame[node] = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue