strlcat(9)
okay bestie, welcome to strlcat(9) from the Kernel API Manual β she appends strings, but pls read the warning before you get attached πβ¨
π NAME π
strlcat β Append a string to an existing string π
β¨ SYNOPSIS β¨
size_t strlcat (char * const p , const char * const q , size_t avail );
π¦ ARGUMENTS π¦
pβ pointer to the NUL-terminated string you're appending to π«Άqβ pointer to the NUL-terminated string you're appending from πΈavailβ maximum bytes available inpβ
π DESCRIPTION π
So the vibe is: strlcat appends the NUL-terminated string q after the NUL-terminated string at p, but it will not write beyond avail bytes total β which can potentially truncate the copy from q π
p will stay NUL-terminated only if a NUL already existed within the avail bytes of p. If that NUL is there, the resulting number of bytes copied from q will be at most avail - strlen(p) - 1 β¨
π¨ Do not use this function. WhileFORTIFY_SOURCEtries to avoid read and write overflows, this is only possible when the sizes ofpandqare known to the compiler. Prefer building the string with formatting, viascnprintf,seq_buf, or similar. no cap, this one's giving deprecated energy π
Returns the total bytes that _would_ have been contained by p regardless of truncation, similar to snprintf. If the return value is >= avail, the string has been truncated ππ₯
π SEE ALSO π
- Kernel file
./include/linux/fortify-string.h unsafe_memcpy(9)strnlen(9)strlen(9)strcat(9)strncat(9)strcpy(9)
mwah π β signed off from ./include/linux, October 2026, on the strlcat(9) page. 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