diff mbox series

[iproute2] lwtunnel: fix warning from strncpy

Message ID 20230421170339.21247-1-stephen@networkplumber.org (mailing list archive)
State Accepted
Commit f666443f4bae700e8ce410d46018563b2de8bca6
Delegated to: David Ahern
Headers show
Series [iproute2] lwtunnel: fix warning from strncpy | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Stephen Hemminger April 21, 2023, 5:03 p.m. UTC
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@networkplumber.org>
---
 ip/iproute_lwtunnel.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org April 21, 2023, 5:10 p.m. UTC | #1
Hello:

This patch was applied to iproute2/iproute2.git (main)
by Stephen Hemminger <stephen@networkplumber.org>:

On Fri, 21 Apr 2023 10:03:39 -0700 you wrote:
> 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@networkplumber.org>
> ---
>  ip/iproute_lwtunnel.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Here is the summary with links:
  - [iproute2] lwtunnel: fix warning from strncpy
    https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=f666443f4bae

You are awesome, thank you!
diff mbox series

Patch

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();