public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] m_tunnel_key: Add check for result hex2mem()
@ 2024-02-18 20:40 Maks Mishin
  2024-02-19 18:06 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Maks Mishin @ 2024-02-18 20:40 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Maks Mishin, netdev

Added check for hex2mem() result to report of error
with incorrect args.

Signed-off-by: Maks Mishin <maks.mishinFZ@gmail.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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-19 18:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-18 20:40 [PATCH] m_tunnel_key: Add check for result hex2mem() Maks Mishin
2024-02-19 18:06 ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox