Hacker News new | ask | show | jobs
by 0xbadc0de5 25 days ago
Except *sshole isn't a memory safety vulnerability - it's a logic bug. And logic bugs happen in every programming language.
2 comments

Yes, this is explicitly discussed in the post:

> This is not a memory safety vulnerability; rather, it is one of those issues that, people often say, languages with better type systems won’t save you from. This is true! You can very well write a Rust function that returns "" if the password is too long. But the big difference between C and Rust in this regard is that the norms of the Rust community do not allow that.*

It is idiomatic C to use in-band sentinel values (NULL is the most prominent example). It is very much not idiomatic rust.
It's also idiomatic in C to use the return value solely for sentinels and pass the actual result in an output variable.