Skip to content

Commit

Permalink
Fix #510: correct macCmd validity check
Browse files Browse the repository at this point in the history
  • Loading branch information
terrillmoore committed Dec 30, 2019
1 parent 306330f commit 5b4d28f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lmic/lmic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 5b4d28f

Please sign in to comment.