RE: https://hachyderm.io/@kees/116282745861595200
Fun to see the Linux kernel follow in #curl's footsteps! 😎 (we removed the last strncpy from curl in late 2025)
RE: https://hachyderm.io/@kees/116282745861595200
Fun to see the Linux kernel follow in #curl's footsteps! 😎 (we removed the last strncpy from curl in late 2025)
@bagder so some time around 2040 we'll have 99% of things using a kernel without it.
My snark comes from two months of broken audio stack on my android phone that was a unterminated string issue.
If the input string is longer than the given limit the output buffer will have no NUL character. As far as I can tell that’s the behavior required by the specification.
If you are lucky there might be a NUL character just after the buffer. But that’s not something you can count on.
What also came as a surprise to me is that it pads the buffer with NUL bytes if the string is shorter. That may be desirable for some use cases, but I think in more common scenarios that just hurts performance.