From e851b079c82ba1bcf3f4d291ab69a571b0bf458a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20W=C3=B6rner?= Date: Tue, 4 Oct 2022 09:30:58 +0200 Subject: [PATCH] Fixed potential buffer overflow in `ProcessRadioRxDone` --- src/mac/LoRaMac.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/mac/LoRaMac.c b/src/mac/LoRaMac.c index 8d42fbb88..31e8f3afc 100644 --- a/src/mac/LoRaMac.c +++ b/src/mac/LoRaMac.c @@ -938,6 +938,14 @@ static void ProcessRadioRxDone( void ) } } + // Abort on empty radio frames + if( size == 0 ) + { + MacCtx.McpsIndication.Status = LORAMAC_EVENT_INFO_STATUS_ERROR; + PrepareRxDoneAbort( ); + return; + } + macHdr.Value = payload[pktHeaderLen++]; // Accept frames of LoRaWAN Major Version 1 only