strlen(9)
π strlen(9) β Kernel API Manual π
okay bestie, welcome to the strlen(9) page from the Kernel API Manual. it's short, it's iconic, and it has one huge safety warning. let's get into it π«Ά
πΈ NAME πΈ
strlen β Return count of characters in a NUL-terminated string
β¨ SYNOPSIS β¨
strlen (p );
π ARGUMENTS π
pβ pointer to NUL-terminated string to count.
π¦ DESCRIPTION π¦
π¨ Do not use this function unless the string length is known at compile-time. Whenpis unterminated, this function may crash or return unexpected counts that could lead to memory content exposures. Preferstrnlen.
Returns number of characters in p (NOT including the final NUL). periodt. π
π SEE ALSO π
cross-refs, go look π:
- Kernel file
./include/linux/fortify-string.hunsafe_memcpy(9),strnlen(9),strlcat(9),strcat(9),strncat(9),strcpy(9)
mwah π okay that's the whole page! source/version: ./include/linux; date: October 2026; and the page is strlen(9). bye bestie, stay NUL-terminated π«Άβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms