iproute/backport-tc-m_action-check-cookie-hex-string-len.patch
2023-12-28 20:08:02 +08:00

37 lines
1.0 KiB
Diff

From 0149dabf2a1bad2f210ca2d987b29083247b7bd0 Mon Sep 17 00:00:00 2001
From: Jiri Pirko <jiri@mellanox.com>
Date: Mon, 27 Apr 2020 08:10:55 +0200
Subject: 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>
Conflict:NA
Reference:https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit?id=0149dabf2a1bad2f210ca2d987b29083247b7bd0
---
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 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);
--
cgit 1.2.3-korg