From dca0b366acd13908260cd0082d49ba44196a2411 Mon Sep 17 00:00:00 2001 From: Jose Alamos Date: Mon, 1 Mar 2021 15:44:17 +0100 Subject: [PATCH] gnrc_lorawan: drop frame if port exceeds max app port --- sys/net/gnrc/link_layer/lorawan/gnrc_lorawan_mcps.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/net/gnrc/link_layer/lorawan/gnrc_lorawan_mcps.c b/sys/net/gnrc/link_layer/lorawan/gnrc_lorawan_mcps.c index ff6e2b1b49..41ca6c7eba 100644 --- a/sys/net/gnrc/link_layer/lorawan/gnrc_lorawan_mcps.c +++ b/sys/net/gnrc/link_layer/lorawan/gnrc_lorawan_mcps.c @@ -118,6 +118,11 @@ int gnrc_lorawan_parse_dl(gnrc_lorawan_t *mac, uint8_t *buf, size_t len, return -1; } + if (pkt->port > LORAMAC_PORT_MAX) { + DEBUG("gnrc_lorawan: packet with port > 223. Drop\n"); + return -1; + } + if (buf < p_mic) { pkt->enc_payload.iol_base = buf; pkt->enc_payload.iol_len = p_mic - buf;