diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-10-06 13:02:50 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-10-06 14:13:09 -0400 |
commit | 246afc1b1ba8c81557307bfffa5291c91cc2c782 (patch) | |
tree | 277339fb4f8a6d70eb44f37fa2bac470320f4e86 /src/common | |
parent | 2412e0e4024325608b551f74140e449d2016916f (diff) | |
download | tor-246afc1b1ba8c81557307bfffa5291c91cc2c782.tar.gz tor-246afc1b1ba8c81557307bfffa5291c91cc2c782.zip |
Make internal error check for unrecognized digest algorithm more robust
Fixes Coverity CID 479.
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/crypto.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c index 851f11bf3b..235bd88ffa 100644 --- a/src/common/crypto.c +++ b/src/common/crypto.c @@ -1663,6 +1663,10 @@ crypto_digest_get_digest(crypto_digest_env_t *digest, SHA256_Final(r, &tmpenv.d.sha2); break; default: + log_warn(LD_BUG, "Called with unknown algorithm %d", digest->algorithm); + /* If fragile_assert is not enabled, then we should at least not + * leak anything. */ + memset(r, 0xff, sizeof(r)); tor_fragile_assert(); break; } |