strncat(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… strncat(9)

okay so this is a page from the Kernel API Manual and bestie, we need to talk about strncat. it's a whole situation. grab a snack. πŸ“


🌸 NAME 🌸

strncat β€” append a string to an existing string

like, the sequel to the string. the string part 2. the string electric boogaloo.


✨ SYNOPSIS ✨

        char * strncat (char * const p , const char * const q , __kernel_size_t
       count );

πŸŽ€ ARGUMENTS πŸŽ€

  • p β€” pointer to a NUL-terminated string, and this is the one you're appending to. the main character, honestly. πŸ‘‘
  • q β€” pointer to the source string you're appending from. the supporting role that still gets screentime.
  • count β€” the maximum number of bytes to read from q. it's giving boundaries. we love boundaries. πŸ¦‹

πŸ’– DESCRIPTION πŸ’–

so what it does: it appends at most count bytes from q (and it stops at the first NUL byte, no cap) after the NUL-terminated string at p. and p will be NUL-terminated. periodt. πŸ’…

and then it returns p. that's it. that's the whole thing.

⚠️ okay so now the serious part, and i need you to actually listen: do not use this function. like, at all. not me being dramatic, it's literally on the page.

here's the tea β€” while FORTIFY_SOURCE tries to avoid read and write overflows, that's only possible when the sizes of p and q are known to the compiler. so if the compiler doesn't know? no protection. none. 😭

instead, prefer building the string with formatting, via scnprintf or similar. that's the vibe. that's the move. 🫢


🌈 SEE ALSO 🌈

the whole string function friend group, basically. they all show up to the group chat. 🧚


and that's the page, bestie! this one came out of ./include/linux in October 2026 β€” so like, remember to check that date if you're citing it, because nothing's more embarrassing than citing a stale manpage. πŸ’€ anyway ily, go use scnprintf, and stay safe out there. πŸŒΈπŸ’œ

πŸ“¦ where this page comes from