3 ms·
For Heartbleed, you need an abstraction like "container that i can write bytes to and then read the same bytes from" which has the leak "sometimes you can read
by twic 11y ago
For Heartbleed, you need an abstraction like "container that i can write bytes to and then read the same bytes from" which has the leak "sometimes you can read other bytes too".
In C, the memory abstraction the language gives you has that leak, so it's really hard to build a container on top of it that doesn't have that leak.
In safer languages, the memory abstraction doesn't have that leak, because bounds are checked, and new byte buffers are initialised to zero. You can still build an abstraction which does have that leak - say, by writing your own reusable byte buffer class which doesn't check bounds or zero on reuse - but at least you have the option of getting it right.
In an even safer language, the type system might make it impossible to make that mistake, or the library might supply a safe implementation of that abstraction already.
Remember, Heartbleed is not about the attacker doing some kind of Jedi memory trick to read your secrets: they are relying on your own code to read things it shouldn't. If the abstractions your program is built on don't allow that, then there's no way for it to be used to that end.
- cuckcuckspruce 11y ago>In C, the memory abstraction the language gives you has that leak, so it's really hard to build a container on top of it that doesn't have that leak. >In safer languages, the memory abstraction doesn't have that leak, because bounds are checked, and new byte buffers are initialised to zero. Most of the implementations of these safer languages are in C, so clearly there's a way to do this correctly in C.