by Dylan16807 · 7y ago · 0 comments
You can memset to 0, and on your compiler it might be secure, but it's not enough to keep your security guaranteed against future compilers.
There's a reason functions like SecureZeroMemory exist. In a similar situation, you try to prevent leaking secure secrets by zeroing memory before releasing it. But the compiler sees you never use the variable again, and optimizes away the zeroing.
The message to take away is not "be less paranoid". It's "be more paranoid".
But the problem is that the security concerns and fixes are all undefined here.
So the initial comment is still very right. If you're relying on the padding to be anything in particular, you're in trouble.
No one in this sub-thread has mentioned (or implied) any "fix". You appear to be putting words in my mouth.
> So the initial comment is still very right.
Of course it's right, but it's also misleading when read in the context of the parent comment.
> If you're relying on the padding to be anything in particular, you're in trouble.
No shit.
I'm talking about the comments hermitdev was replying to that were treating memset as a 'fix'.
And 'fix' is shorthand for the opposite of "open[ing] you up to all kinds of info leaks". I don't think that's putting words in anyone's mouth.