ieee802154_shell: Only accept channels within expected range
Fixes the following issue: "In expression 1UL << chan - 1U, left shifting by more than 31 bits has undefined behavior. The shift amount, chan - 1U, is 4294967295." Coverity-CID: 167140 Jira: ZEP-2131 Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
This commit is contained in:
parent
bee2b8499b
commit
111244923c
1 changed files with 4 additions and 1 deletions
|
@ -122,7 +122,10 @@ static inline u32_t parse_channel_set(char *str_set)
|
|||
}
|
||||
|
||||
chan = atoi(p);
|
||||
channel_set |= BIT(chan - 1);
|
||||
if (chan > 0 && chan < 32) {
|
||||
channel_set |= BIT(chan - 1);
|
||||
}
|
||||
|
||||
p = n ? n + 1 : n;
|
||||
} while (n);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue