2 ms·
Having not done much Rust due to the volatility, I still have to give it credit here for a few more reasons: * I assume old_io is going away. That is why it is
by zanny 12y ago
Having not done much Rust due to the volatility, I still have to give it credit here for a few more reasons:
* I assume old_io is going away. That is why it is old, after all. Is this still possible in the new_io? If they made this not doable anymore that means they fixed the bug.
* The compiler spat out a warning. Maybe it should have been "you dumb fuck why are you doing raw buffer reads and writes" but at least it said "old_io is bad".
* I don't see much in the C version that would generate any warnings or errors under any compiler flags. That should be the take away, in my book.
When I do my own projects I almost always go for maximum warnings and errors, and don't call it done until the compiler stops generating them.
- kibwen 12y agoThe fundamental underlying problem is that a buffer containing sensitive data is being reused for a separate purpose without being scrubbed of the sensitive data. In the particular instance of heartbleed, this faulty behavior was due to the underlying memory allocator rather than any property of the programming language. It is true that idiomatic Rust tends to avoid working with raw buffers, but for low-level tasks this is sometimes unavoidable. Rust also especially doesn't encourage reusing buffers, but if you've already taken the step of specifying an unsafe memory allocator then Rust can't help you. So yes, Rust gives you a lot of tools to avoid this situation but it can't outright prevent it, as a few people on the internet appeared to be suggesting last year.