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:
Leandro Pereira 2017-05-22 17:00:27 -07:00 committed by Anas Nashif
commit 111244923c

View file

@ -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);