strlcat(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

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 in p ⭐

πŸ’… 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. While FORTIFY_SOURCE tries to avoid read and write overflows, this is only possible when the sizes of p and q are known to the compiler. Prefer building the string with formatting, via scnprintf, 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 🌈


mwah πŸ’‹ β€” signed off from ./include/linux, October 2026, on the strlcat(9) page. bye bestie, stay NUL-terminated πŸ«ΆπŸŽ€

πŸ“¦ where this page comes from