diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2022-07-11 17:43:59 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2022-07-11 17:43:59 +0000 |
commit | 7a31d25b67dc7aa18f09a68720b1a3ecffaad93a (patch) | |
tree | 74f7c9966ec8a7f0bb0f3e4089b3207312e4d713 /src | |
parent | Merge pull request #8413 (diff) | |
download | monero-7a31d25b67dc7aa18f09a68720b1a3ecffaad93a.tar.xz |
keccak: error out if passed mdlen 100
If we were to call it with 100, it would cause rsiz to be 0,
leading to an infinite loop.
This is really a pedantic patch, but since there's already a
range test, might as well make it better.
Diffstat (limited to 'src')
-rw-r--r-- | src/crypto/keccak.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/crypto/keccak.c b/src/crypto/keccak.c index f098cbdf0..6616d3530 100644 --- a/src/crypto/keccak.c +++ b/src/crypto/keccak.c @@ -123,7 +123,7 @@ void keccak(const uint8_t *in, size_t inlen, uint8_t *md, int mdlen) size_t i, rsiz, rsizw; static_assert(HASH_DATA_AREA <= sizeof(temp), "Bad keccak preconditions"); - if (mdlen <= 0 || (mdlen > 100 && sizeof(st) != (size_t)mdlen)) + if (mdlen <= 0 || (mdlen >= 100 && sizeof(st) != (size_t)mdlen)) { local_abort("Bad keccak use"); } |