diff options
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/hash.cc | 1 | ||||
-rw-r--r-- | src/libutil/hash.hh | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/src/libutil/hash.cc b/src/libutil/hash.cc index 599d375dca2f..cd7043090ec7 100644 --- a/src/libutil/hash.cc +++ b/src/libutil/hash.cc @@ -22,6 +22,7 @@ Hash::Hash(HashType type) else if (type == htSHA1) hashSize = sha1HashSize; else if (type == htSHA256) hashSize = sha256HashSize; else throw Error("unknown hash type"); + assert(hashSize <= maxHashSize); memset(hash, 0, hashSize); } diff --git a/src/libutil/hash.hh b/src/libutil/hash.hh index d82cd87a2166..4490d2ff7ace 100644 --- a/src/libutil/hash.hh +++ b/src/libutil/hash.hh @@ -18,7 +18,7 @@ const int sha256HashSize = 32; struct Hash { - static const unsigned int maxHashSize = 20; + static const unsigned int maxHashSize = 32; unsigned int hashSize; unsigned char hash[maxHashSize]; |