mirror of
https://github.com/CPunch/Laika.git
synced 2024-12-27 05:10: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:
parent
22df7e3702
commit
af05611914
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user