Skip to contentSkip to conversation

lwtunnel: fix warning from strncpy

PATCH Applied Stephen Hemminger 2 participants 2 messages Apr 21, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 ip/iproute_lwtunnel.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
ip/iproute_lwtunnel.c +1 -2
index 9fcbdeac3e77..d3100234d241 100644
@@ -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();
Signature · 1 line
2.39.2
#1 lore raw
This patch was applied to iproute2/iproute2.git (main) by Stephen Hemminger <[email protected]>:

Hello:

This patch was applied to iproute2/iproute2.git (main) by Stephen Hemminger <[email protected]>:

Quoted 8 lines · 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.

---
 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!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html