News for hackers. Stuff that matters.
Re:I'm Not a Fan of Strlcpy(3) by MathMonkeyMan on Monday July 15, 2024 @09:30AM (#40967743)
The null code point? That would be pedantic even by my standards.
Re:I'm Not a Fan of Strlcpy(3) by saagarjha on Monday July 15, 2024 @09:40AM (#40967814)
Look I had to include it or someone is going to do a whole pedantic comment about how C can’t actually represent UTF-8 correctly
Re:I'm Not a Fan of Strlcpy(3) by kstenerud on Monday July 15, 2024 @10:46AM (#40968340)
You could have just said it rather than going through this smug "I know something you don't know!" song and dance.

Also, by this rationale, NO string is ever safe in C, because pretty much every encoding technically supports codepoint 0 (even though you take your life into your hands should you ever use it). This is not a useful discussion.

Re:I'm Not a Fan of Strlcpy(3) by saagarjha on Wednesday July 17, 2024 @05:59AM (#40984154)
I mean strings that don't use that codepoint are fine, and that's most strings as I mentioned above.
Re:I'm Not a Fan of Strlcpy(3) by Sebb767 on Monday July 15, 2024 @10:18AM (#40968108)
Actually, by just alluding to the bug without saying it explicitly, you managed to both be pedantic and not avoid the discussion.

This is not meant as a personal attack; I just want to point out how it looks on a casual reading :)

Re:I'm Not a Fan of Strlcpy(3) by saagarjha on Wednesday July 17, 2024 @05:57AM (#40984134)
Well, I'm not perfect ;)
Re:I'm Not a Fan of Strlcpy(3) by pdpi on Monday July 15, 2024 @10:00AM (#40967974)
By that metric, C can't represent ASCII correctly either, because there's no particular reason you couldn't have a NUL character somewhere inside a string.
Re:I'm Not a Fan of Strlcpy(3) by TeMPOraL on Monday July 15, 2024 @11:17AM (#40968616)
Indeed it can't. Many developers were bitten by this, and still are; plenty of critical bugs and security vulnerabilities rely on this quirk too.
Re:I'm Not a Fan of Strlcpy(3) by account42 on Monday July 15, 2024 @11:37AM (#40968825)
Technically, C can. It's just C strings that are limited.
Re:I'm Not a Fan of Strlcpy(3) by pdpi on Monday July 15, 2024 @11:40AM (#40968854)
Sure, in the exact same way that C can handle unicode just fine too. The problem is, as always, C strings.