Skip to contentSkip to conversation

tc: m_action: check cookie hex string len

PATCH Applied Jiri Pirko 2 participants 2 messages Apr 27, 2020 – Apr 28, 2020

Subsystems (2)
lore
Share & tools
lore

Jiri Pirko

author
#0 lore raw

PATCH 1/1 tc: m_action: check cookie hex string len

From: Jiri Pirko <[email protected]>

Check the cookie hex string len is dividable by 2 as the valid hex string always should be.

---
 tc/m_action.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tc/m_action.c +2 -1
index 108329db29d0..b41782de9a02 100644
@@ -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);
 
Signature · 1 line
2.21.1