]> git.proxmox.com Git - mirror_iproute2.git/commit
tc: flower: fix port value truncation
authorLukasz Czapnik <lukasz.czapnik@gmail.com>
Mon, 27 May 2019 21:03:49 +0000 (23:03 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Tue, 28 May 2019 19:27:01 +0000 (12:27 -0700)
commit767b6fd620ddc4319a121595f953313b2e9789ff
treec56181c56573f366a9fb4ab15b6c1f80247e4839
parent757837230a654d39623d0b90882b695a2facd107
tc: flower: fix port value truncation

sscanf truncates read port values silently without any error. As sscanf
man says:
(...) sscanf() conform to C89 and C99 and POSIX.1-2001. These standards
do not specify the ERANGE error.

Replace sscanf with safer get_be16 that returns error when value is out
of range.

Example:
tc filter add dev eth0 protocol ip parent ffff: prio 1 flower ip_proto
tcp dst_port 70000 hw_tc 1

Would result in filter for port 4464 without any warning.

Fixes: 8930840e678b ("tc: flower: Classify packets based port ranges")
Signed-off-by: Lukasz Czapnik <lukasz.czapnik@intel.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
tc/f_flower.c