]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
tc: m_action: check cookie hex string len
authorJiri Pirko <jiri@mellanox.com>
Mon, 27 Apr 2020 06:10:55 +0000 (08:10 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Mon, 27 Apr 2020 21:50:27 +0000 (14:50 -0700)
Check the cookie hex string len is dividable by 2 as the valid hex
string always should be.

Reported-by: Alex Kushnarov <alexanderk@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
tc/m_action.c

index 108329db29d0b769b85ff4e2e6153292ee37b573..b41782de9a024d11f5011407245e04c222dfd96e 100644 (file)
@@ -291,7 +291,8 @@ done0:
                                        invarg(cookie_err_m, *argv);
                                }
 
-                               if (hex2mem(*argv, act_ck, slen / 2) < 0)
+                               if (slen % 2 ||
+                                   hex2mem(*argv, act_ck, slen / 2) < 0)
                                        invarg("cookie must be a hex string\n",
                                               *argv);