Linux eliminates the strncpy API after six years of work, 360 patches(phoronix.com)
239 points by simonpure 15 hours ago | 228 comments
tl;dr: After six years and 362 commits, Linux 7.2 has fully removed the strncpy() API from the kernel, which was long deprecated due to bug-prone NUL termination semantics and performance overhead from redundant zero-filling. Developers should now use replacements like strscpy(), strscpy_pad(), strtomem_pad(), memcpy_and_pad(), or plain memcpy() depending on the use case.
HN Discussion:
  • C's NUL-terminated strings are fundamentally flawed; better string types should have existed
  • strncpy is almost always misused and removing it is a clear win
  • Appreciation for the unglamorous long-term maintenance work of removing bad APIs
  • Clarifying technical terminology confusion (NUL vs NULL) in the discussion
  • Sharing related anecdotes about legacy string-handling quirks in other systems