diff options
author | Linus Groh <mail@linusgroh.de> | 2021-02-14 10:25:12 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-02-14 10:51:00 +0100 |
commit | 1c6fd749dc85edab13fdccd6cca81c50f2436603 (patch) | |
tree | 7f5b3e3aa6c71a6b1752377a2310fe3808722693 /Userland/Libraries/LibCrypto | |
parent | 781d29a3372ec1f3de97ffc1860f83d4ad1b1f1b (diff) | |
download | serenity-1c6fd749dc85edab13fdccd6cca81c50f2436603.zip |
LibCrypto: memcmp() all bytes in UnsignedBigInteger::operator==
`length` is only the (trimmed) size of the word vector, so we have to
multiply it with the size of each element to ensure all bytes are
compared.
Fixes #5335.
Diffstat (limited to 'Userland/Libraries/LibCrypto')
-rw-r--r-- | Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp b/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp index ef838ec782..63021614bb 100644 --- a/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp +++ b/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp @@ -281,7 +281,7 @@ bool UnsignedBigInteger::operator==(const UnsignedBigInteger& other) const if (length != other.trimmed_length()) return false; - return !__builtin_memcmp(m_words.data(), other.words().data(), length); + return !__builtin_memcmp(m_words.data(), other.words().data(), length * (BITS_IN_WORD / 8)); } bool UnsignedBigInteger::operator!=(const UnsignedBigInteger& other) const |