[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230421170339.21247-1-stephen@networkplumber.org>
Date: Fri, 21 Apr 2023 10:03:39 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: netdev@...r.kernel.org
Cc: Stephen Hemminger <stephen@...workplumber.org>
Subject: [PATCH iproute2] lwtunnel: fix warning from strncpy
The code for parsing segments in lwtunnel would trigger a warning
about strncpy if address sanitizer was enabled. Simpler to just
use strlcpy() like elsewhere.
Signed-off-by: Stephen Hemminger <stephen@...workplumber.org>
---
ip/iproute_lwtunnel.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/ip/iproute_lwtunnel.c b/ip/iproute_lwtunnel.c
index 9fcbdeac3e77..d3100234d241 100644
--- a/ip/iproute_lwtunnel.c
+++ b/ip/iproute_lwtunnel.c
@@ -1468,8 +1468,7 @@ static int parse_encap_seg6local(struct rtattr *rta, size_t len, int *argcp,
NEXT_ARG();
if (segs_ok++)
duparg2("segs", *argv);
- strncpy(segbuf, *argv, 1024);
- segbuf[1023] = 0;
+ strlcpy(segbuf, *argv, 1024);
if (!NEXT_ARG_OK())
break;
NEXT_ARG();
--
2.39.2
Powered by blists - more mailing lists