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>
This commit is contained in:
Jiri Pirko 2020-04-27 08:10:55 +02:00 committed by Stephen Hemminger
parent b831c5ffcc
commit 0149dabf2a

View 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);