Join Nostr
2026-06-21 06:23:06 UTC

Thorsten Leemhuis (acct. 1/4) on Nostr: The string copying API #strncpy was finally removed from #Linux for #LinuxKernel 7.2 ...

The string copying API #strncpy was finally removed from #Linux for #LinuxKernel 7.2 via these changes submitted by :

https://git.kernel.org/torvalds/c/1a3746ccbb0a97bed3c06ccde6b880013b1dddc1

He also removed the fuction itself:

https://git.kernel.org/torvalds/c/079a028d6327e68cfa5d38b36123637b321c19a7

To quote: ""strncpy() has been a persistent source of bugs due to its ambiguous intended usage and frequently counter-intuitive semantics: it may not NUL-terminate the destination, and it unconditionally zero-pads to the full length, which isn't always needed. All former callers have been migrated to: […] https://github.com/KSPP/linux/issues/90";

For some of the problems of this API, see the following great articles:

* strscpy() and the hazards of improved interfaces – https://lwn.net/Articles/659214/
* Ushering out strlcpy() – https://lwn.net/Articles/905777/
* Better string handling for the kernel – https://lwn.net/Articles/948408/

#Kernel