News for hackers. Stuff that matters.
Re:I'm Not a Fan of Strlcpy(3) by saagarjha on Monday July 15, 2024 @09:39AM (#40967804)
Morally I view “what do I do with my truncated string” to be a separate issue from “how do I truncate the string” as described in the article. Like, yes, you absolutely should not concatenate after doing this operation. But maybe you shouldn’t be showing the user a truncated string either even if it’s all ASCII. The question of “did you make an unparseable UTF-8 string” is answered with “no” and the more complicated but also more interesting question of “did you actually want this” remains unanswered.
Re:I'm Not a Fan of Strlcpy(3) by Levitating on Monday July 15, 2024 @10:25AM (#40968152)
This is fair, the article takes truncating a string to fit in a status bar as an example.