tc: don't accept qdisc 'handle' greater than ffff

since get_qdisc_handle() truncates the input value to 16 bit, return an
error and prompt "invalid qdisc ID" in case input 'handle' parameter needs
more than 16 bit to be stored.

Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Acked-by: Phil Sutter <phil@nwl.cc>
This commit is contained in:
Davide Caratti 2016-09-16 10:30:00 +02:00 committed by Stephen Hemminger
parent 003f0fde69
commit 087dec7fcf
1 changed files with 1 additions and 1 deletions

View File

@ -82,7 +82,7 @@ int get_qdisc_handle(__u32 *h, const char *str)
if (strcmp(str, "none") == 0)
goto ok;
maj = strtoul(str, &p, 16);
if (p == str)
if (p == str || maj >= (1 << 16))
return -1;
maj <<= 16;
if (*p != ':' && *p != 0)