From 5b4d28f710b28fe05639825cc98d80b209b46a47 Mon Sep 17 00:00:00 2001 From: Terry Moore Date: Mon, 30 Dec 2019 11:48:27 -0500 Subject: [PATCH] Fix #510: correct macCmd validity check --- src/lmic/lmic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lmic/lmic.c b/src/lmic/lmic.c index 3fcb4e84..3dce9c07 100644 --- a/src/lmic/lmic.c +++ b/src/lmic/lmic.c @@ -721,7 +721,7 @@ static CONST_TABLE(u1_t, macCmdSize)[] = { static u1_t getMacCmdSize(u1_t macCmd) { if (macCmd < 2) return 0; - if (macCmd >= LENOF_TABLE(macCmdSize) - 2) + if ((macCmd - 2) >= LENOF_TABLE(macCmdSize)) return 0; return TABLE_GET_U1(macCmdSize, macCmd - 2); }