From: Jiri Pirko Date: Mon, 27 Apr 2020 06:10:55 +0000 (+0200) Subject: tc: m_action: check cookie hex string len X-Git-Tag: v5.7.0~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0149dabf2a1bad2f210ca2d987b29083247b7bd0;p=thirdparty%2Fiproute2.git 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 --- 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);