Thread (2 messages) 2 messages, 2 authors, 2025-11-29

Re: [PATCH net-next v2] net: ipconfig: Replace strncpy with strscpy in ic_proto_name

From: patchwork-bot+netdevbpf@kernel.org
Date: 2025-11-29 04:33:22
Also in: lkml

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski [off-list ref]:

On Wed, 26 Nov 2025 23:08:05 +0100 you wrote:
strncpy() is deprecated [1] for NUL-terminated destination buffers
because it does not guarantee NUL termination. Replace it with strscpy()
to ensure the destination buffer is always NUL-terminated and to avoid
any additional NUL padding.

Although the identifier buffer has 252 usable bytes, strncpy() copied
only up to 251 bytes to the zero-initialized buffer, relying on the last
byte to act as an implicit NUL terminator. Switching to strscpy() avoids
this implicit behavior and does not use magic numbers.

[...]
Here is the summary with links:
  - [net-next,v2] net: ipconfig: Replace strncpy with strscpy in ic_proto_name
    https://git.kernel.org/netdev/net-next/c/ff736a286116

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help