From: Li Wei Date: Tue, 10 Jul 2012 08:45:28 +0000 (+0800) Subject: tc: filter: validate filter priority in userspace. X-Git-Tag: v3.5.0~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=424adc19bf6365224ab2b594fad78681e0a028c3;p=thirdparty%2Fiproute2.git tc: filter: validate filter priority in userspace. Because we use the high 16 bits of tcm_info to pass prio value to kernel, thus it's range would be [0, 0xffff], without validation in tc when user pass a lager(>65535) priority, the actual priority set in kernel would confuse the user. So, add a validation to ensure prio in the range. --- diff --git a/tc/tc_filter.c b/tc/tc_filter.c index 207302fc2..04c3b824b 100644 --- a/tc/tc_filter.c +++ b/tc/tc_filter.c @@ -105,7 +105,7 @@ int tc_filter_modify(int cmd, unsigned flags, int argc, char **argv) NEXT_ARG(); if (prio) duparg("priority", *argv); - if (get_u32(&prio, *argv, 0)) + if (get_u32(&prio, *argv, 0) || prio > 0xFFFF) invarg(*argv, "invalid priority value"); } else if (matches(*argv, "protocol") == 0) { __u16 id;