netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2] lwtunnel: fix warning from strncpy
@ 2023-04-21 17:03 Stephen Hemminger
  2023-04-21 17:10 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2023-04-21 17:03 UTC (permalink / raw)
  To: netdev; +Cc: Stephen Hemminger

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

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


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

* Re: [PATCH iproute2] lwtunnel: fix warning from strncpy
  2023-04-21 17:03 [PATCH iproute2] lwtunnel: fix warning from strncpy Stephen Hemminger
@ 2023-04-21 17:10 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-04-21 17:10 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2023-04-21 17:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-21 17:03 [PATCH iproute2] lwtunnel: fix warning from strncpy Stephen Hemminger
2023-04-21 17:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).