From: Stephen Hemminger Date: Fri, 21 Apr 2023 17:01:51 +0000 (-0700) Subject: lwtunnel: fix warning from strncpy X-Git-Tag: v6.3.0~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f666443f4bae700e8ce410d46018563b2de8bca6;p=thirdparty%2Fiproute2.git 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 --- diff --git a/ip/iproute_lwtunnel.c b/ip/iproute_lwtunnel.c index 9fcbdeac3..d3100234d 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();