]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
tc: don't accept qdisc 'handle' greater than ffff
authorDavide Caratti <dcaratti@redhat.com>
Fri, 16 Sep 2016 08:30:00 +0000 (10:30 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Tue, 20 Sep 2016 16:44:59 +0000 (09:44 -0700)
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>
tc/tc_util.c

index 15e49b7ba29995f6b1d5b1d40a08b9db3f4f29fe..24ca1f1c1c0400972bfd7acd93e88ba568ebda5f 100644 (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)