logoalt Hacker News

userbinator • today at 3:29 AM • 2 replies • view on HN

What's "horrendous"? I don't see anything which stands out as being wrong. It specifies exactly the lengths of input and output.

gets(), on the other hand, that is "horrendous".


Replies

amluto • today at 4:10 AM

Even in C, if you have a function that takes an input buffer and output buffer of differing lengths, the right API has the caller pass both lengths.

But yes, gets is worse.

➕ show 1 reply
kvuj • today at 3:33 AM

Perhaps I'm just used to having programmed in C# professionally for a little bit, but these sorts of APIs where you have to do a calculation to determine the destination buffer size make me feel like a caveman. A minuscule typo and you get a CVE like this.

I know, I know, C is low level and high performance, but surely in the year of our lord 2026, we could have come out with something simpler.

Horrendous is a strong word, you're right.