From 0149dabf2a1bad2f210ca2d987b29083247b7bd0 Mon Sep 17 00:00:00 2001 From: Jiri Pirko Date: Mon, 27 Apr 2020 08:10:55 +0200 Subject: [PATCH] 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 Signed-off-by: Jiri Pirko Signed-off-by: Stephen Hemminger --- tc/m_action.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tc/m_action.c b/tc/m_action.c index 108329db..b41782de 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); -- 2.39.5