[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240218204026.7273-1-maks.mishinFZ@gmail.com>
Date: Sun, 18 Feb 2024 23:40:26 +0300
From: Maks Mishin <maks.mishinfz@...il.com>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: Maks Mishin <maks.mishinFZ@...il.com>,
netdev@...r.kernel.org
Subject: [PATCH] m_tunnel_key: Add check for result hex2mem()
Added check for hex2mem() result to report of error
with incorrect args.
Signed-off-by: Maks Mishin <maks.mishinFZ@...il.com>
---
tc/m_tunnel_key.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tc/m_tunnel_key.c b/tc/m_tunnel_key.c
index ff699cc8..9bb5c2aa 100644
--- a/tc/m_tunnel_key.c
+++ b/tc/m_tunnel_key.c
@@ -575,7 +575,10 @@ static void tunnel_key_print_geneve_options(struct rtattr *attr)
data_len = RTA_PAYLOAD(tb[TCA_TUNNEL_KEY_ENC_OPT_GENEVE_DATA]);
hexstring_n2a(RTA_DATA(tb[TCA_TUNNEL_KEY_ENC_OPT_GENEVE_DATA]),
data_len, data, sizeof(data));
- hex2mem(data, data_r, data_len);
+
+ if (hex2mem(data, data_r, data_len) < 0)
+ invarg("labels mask must be a hex string\n", data);
+
offset += data_len + 20;
rem -= data_len + 20;
i = RTA_DATA(attr) + offset;
--
2.30.2
Powered by blists - more mailing lists