Hasty Briefsbeta

Bilingual

Linux Eliminates the Strncpy API After Six Years of Work, 360 Patches

7 hours ago
  • #Linux Kernel
  • #API Deprecation
  • #strncpy Removal
  • Linux 7.2 has eliminated the strncpy API from the Linux kernel after six years of work and 362 patches.
  • strncpy was a persistent source of bugs due to counter-intuitive semantics around NUL termination and performance issues from redundant zero-filling.
  • Replacement functions include strscpy(), strscpy_pad(), strtomem_pad(), memcpy_and_pad(), and memcpy() for specific use cases.