aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Pirko <jiri@mellanox.com>2020-04-27 08:10:55 +0200
committerStephen Hemminger <stephen@networkplumber.org>2020-04-27 14:50:27 -0700
commit0149dabf2a1bad2f210ca2d987b29083247b7bd0 (patch)
tree3f58b2bfa52e02e3c20ef06fde45babab74bc568
parentb831c5ffcc78a518dcd267717a299ce158b0475c (diff)
downloadiproute2-0149dabf2a1bad2f210ca2d987b29083247b7bd0.tar.gz
tc: m_action: check cookie hex string len
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>
-rw-r--r--tc/m_action.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tc/m_action.c b/tc/m_action.c
index 108329db2..b41782de9 100644
--- a/tc/m_action.c
+++ b/tc/m_action.c
@@ -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);