mirror of
https://github.com/CPunch/Laika.git
synced 2024-11-21 20:40:05 +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);
|
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 */
|
||||||
|
Loading…
Reference in New Issue
Block a user