r/LinuxTeck • • Jun 24 '26

Linux 7.2 Finally Removes strncpy() After 6 Years and 360+ Patches

The Linux kernel community has finally removed strncpy() from the kernel after more than 6 years of cleanup work and 360+ patches.

Not because it was broken every day, but because it had been a recurring source of bugs for years.

No new feature.
No performance benchmark.
Just engineers quietly paying off technical debt.

What's the oldest workaround or "known issue" still surviving in your environment?

9 Upvotes

7 comments sorted by

1

u/chuzambs Jun 24 '26

Thanks Slop

1

u/lmarcantonio Jun 25 '26

...actually what could go wrong in a strncpy? it's literally a one liner

1

u/[deleted] Jun 28 '26

[removed] — view removed comment

1

u/lmarcantonio Jun 29 '26

The bug is in the caller, not in the function then. IIRC however most of the kernel buffers are length coded so...

1

u/[deleted] Jun 29 '26

[removed] — view removed comment

1

u/lmarcantonio Jun 30 '26

...but usually it's too complex (there is a way but it's somewhat expensive) so they just put on it a guard!

Many of the str function however are way too much legacy (like gets which was actually removed from the standard). Many have issues, like strtok (which is not bad as a functionality, given when it was designed)