1
0
mirror of https://github.com/CPunch/Laika.git synced 2024-11-22 04:50:06 +00:00

Sanity check that pktIDs from VAR_REQ packets are actually variadic

- variadic packets *MUST* have a PKTSIZE of 0 in the provided pktSizeTable
This commit is contained in:
CPunch 2022-01-26 15:20:07 -06:00
parent 22df7e3702
commit af05611914

View File

@ -49,8 +49,8 @@ bool laikaS_handlePeerIn(struct sLaika_peer *peer) {
peer->pktID = laikaS_readByte(&peer->sock); peer->pktID = laikaS_readByte(&peer->sock);
/* sanity check packet ID */ /* sanity check packet ID, (check valid range, check it's variadic) */
if (peer->pktID >= LAIKAPKT_MAXNONE) if (peer->pktID >= LAIKAPKT_MAXNONE || peer->pktSizeTable[peer->pktID])
LAIKA_ERROR("received evil pktID!\n") LAIKA_ERROR("received evil pktID!\n")
/* try reading new packet size */ /* try reading new packet size */