News › linux

Linux 7.2 Finally Drops the Deprecated strncpy API After Years of Effort

By Zayden R., June 21, 2026

The Linux 7.2 kernel release has officially removed the outdated strncpy API after six years of diligent work and over 360 patches. This change marks a significant step in modernizing the kernel's codebase.

In a move that underscores the ongoing evolution of the Linux kernel, version 7.2 has officially removed the longstanding strncpy API. This change comes after six years of persistent effort by developers and over 360 patches aimed at phasing out the deprecated function. The strncpy function, which allowed copying up to a specified number of bytes, has been a staple in C programming for decades. However, its shortcomings, particularly related to buffer overflows and inefficiencies, have made it a target for replacement.

The removal of strncpy is not just a simple code cleanup. It's a significant step towards improving the security and performance of the Linux kernel. Developers have been gradually replacing strncpy with safer alternatives like strscpy and strlcpy, which provide better guarantees against buffer overflows and are generally more efficient. This transition required a meticulous examination of the codebase, ensuring that each instance of strncpy was appropriately replaced without introducing new bugs.

For kernel developers and sysadmins, this is a solid improvement. It reduces the risk of vulnerabilities associated with buffer overflows, a common source of security exploits. By modernizing the codebase, the Linux community continues to enhance the reliability and robustness of the kernel, which is critical for systems that rely on Linux for stability and security.

The elimination of strncpy is a testament to the collaborative effort within the open-source community, demonstrating the importance of continuous improvement and modernization. This change will likely lead to cleaner, more maintainable code, benefiting both current and future Linux kernel development.

Sources

Practice this on a real machine

The Linux Camp teaches these topics as hands-on labs on real virtual machines, verified as you type.