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
1 changed files with 2 additions and 2 deletions

View File

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