mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Add and use and unlikely-to-be-eliminated memwipe()
Apparently some compilers like to eliminate memset() operations on data that's about to go out-of-scope. I've gone with the safest possible replacement, which might be a bit slow. I don't think this is critical path in any way that will affect performance, but if it is, we can work on that in 0.2.4. Fixes bug 7352.
This commit is contained in:
@@ -4596,7 +4596,7 @@ tor_version_parse(const char *s, tor_version_t *out)
|
||||
if (close_paren-cp > HEX_DIGEST_LEN)
|
||||
return -1;
|
||||
hexlen = (int)(close_paren-cp);
|
||||
memset(digest, 0, sizeof(digest));
|
||||
memwipe(digest, 0, sizeof(digest));
|
||||
if ( hexlen == 0 || (hexlen % 2) == 1)
|
||||
return -1;
|
||||
if (base16_decode(digest, hexlen/2, cp, hexlen))
|
||||
|
||||
Reference in New Issue
Block a user