Repository navigation
fix: use memcpy for the non-terminated copy - #12
Merged
Merged
Conversation
Linux 7.2 removed strncpy() from <linux/string.h>, so the in-kernel build fails with an implicit declaration. This copy was memcpy semantics all along: cp_len bytes into a buffer the caller then advances by cp_len, no NUL involved.
bonifaido
force-pushed
the
fix/strncpy-removed-in-linux-7.2
branch
from
September 10, 2026 06:26
d954d91 to
82f35ed
Compare
stoader
approved these changes
Sep 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linux 7.2 removed the
strncpy()prototype from<linux/string.h>— it now appears there only in kernel-doc prose pointing at the replacements. That breaks the in-kernel build of this signer with:The call was
memcpysemantics all along: it copiescp_lenbytes into a buffer the caller then advances by exactlycp_len, with no NUL terminator involved anywhere.memcpyis what upstream's own docs point to for this case (strscpyis for real C-string copies and would truncate the last byte here).No behaviour change on any kernel: the source is never shorter than
cp_len, sostrncpy's NUL-padding branch could not trigger.Verified by building
riptides.ko+riptides_pro.koagainst 5.15, 6.18.41, 7.0 and 7.2.4 kernel headers.