strcpy(9)
π strcpy(9) β straight from the Kernel API Manual, bestie π
πΈ NAME πΈ
strcpy β copy a string into another string buffer. That's the whole vibe, okay?
β¨ SYNOPSIS β¨
char * strcpy (char * const p , const char * const q );
π ARGUMENTS π
pβ pointer to destination of copy. That's where the string is going, bestie.qβ pointer to NUL-terminated source string to copy. NUL-terminated, not vibe-terminated.
π DESCRIPTION π
π¨ Do not use this function. π¨ Like, seriously, bestie. This is not the one.
While FORTIFY_SOURCE tries to avoid overflows, this is only possible when the sizes of q and p are known to the compiler. So yeah, it's giving βprotection with conditions,β not a free pass.
Prefer strscpy, though note its different return values for detecting truncation. That part matters, so don't just swap it in and call it a day.
Returns p. Yep, that's the whole return situation. π
π¦ SEE ALSO π¦
- Kernel file
./include/linux/fortify-string.h unsafe_memcpy(9),strnlen(9),strlen(9),strlcat(9),strcat(9),strncat(9)
Okay that's the strcpy(9) page, bestie β source/version ./include/linux, dated October 2026. Slay, stay safe, and maybe use strscpy. πβ¨
π¦ 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