From: Davide Caratti Date: Fri, 16 Sep 2016 08:30:00 +0000 (+0200) Subject: tc: don't accept qdisc 'handle' greater than ffff X-Git-Tag: v4.8.0~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=087dec7fcfb18fc4e8a0ec68c9c0a84cb9f03e69;p=thirdparty%2Fiproute2.git 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 Acked-by: Phil Sutter --- diff --git a/tc/tc_util.c b/tc/tc_util.c index 15e49b7ba..24ca1f1c1 100644 --- a/tc/tc_util.c +++ b/tc/tc_util.c @@ -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)