Skip to content

fix: use memcpy for the non-terminated copy - #12

Merged
bonifaido merged 1 commit into
mainfrom
fix/strncpy-removed-in-linux-7.2
Sep 10, 2026
Merged

bonifaido merged 1 commit into
mainfrom
fix/strncpy-removed-in-linux-7.2

Conversation

@bonifaido

@bonifaido bonifaido commented Sep 10, 2026 •

Copy link
Copy Markdown
Member

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:

error: implicit declaration of function 'strncpy' [-Wimplicit-function-declaration]

The call was memcpy semantics all along: it copies cp_len bytes into a buffer the caller then advances by exactly cp_len, with no NUL terminator involved anywhere. memcpy is what upstream's own docs point to for this case (strscpy is 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, so strncpy's NUL-padding branch could not trigger.

Verified by building riptides.ko + riptides_pro.ko against 5.15, 6.18.41, 7.0 and 7.2.4 kernel headers.

@bonifaido
bonifaido requested a review from a team September 10, 2026 06:23
@bonifaido bonifaido self-assigned this Sep 10, 2026
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
bonifaido force-pushed the fix/strncpy-removed-in-linux-7.2 branch from d954d91 to 82f35ed Compare September 10, 2026 06:26
@bonifaido
bonifaido merged commit 858405d into main Sep 10, 2026
1 check passed
@bonifaido
bonifaido deleted the fix/strncpy-removed-in-linux-7.2 branch September 10, 2026 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants