From 8627f5b85d0afa648689e48d5deb5bcb335e0a93 Mon Sep 17 00:00:00 2001 From: CPunch Date: Thu, 27 Jan 2022 20:10:41 -0600 Subject: [PATCH] lpeer.c: pktSize sanity check --- lib/src/lpeer.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/src/lpeer.c b/lib/src/lpeer.c index 517cdaa..983a570 100644 --- a/lib/src/lpeer.c +++ b/lib/src/lpeer.c @@ -45,6 +45,10 @@ bool laikaS_handlePeerIn(struct sLaika_peer *peer) { LAIKA_ERROR("received evil pktID!\n") peer->pktSize = peer->pktSizeTable[peer->pktID]; + + if (peer->pktSize == 0) + LAIKA_ERROR("unsupported packet!\n") + break; case LAIKAPKT_VARPKT_REQ: /* try grabbing pktID & size */