mirror of
https://github.com/SerenityOS/serenity.git
synced 2026-11-07 04:29:30 -10:00
LibCrypto: Fix HMAC nullptr deref when key has length 0
While a key of length zero seems like a bad idea in general, the WPT tests end up calling exactly this, so we need to support it one way or another. (cherry picked from commit e1c3e212defe92b4afe36e8184ffda5a08d0abdb)
This commit is contained in:
1 parent
6598ff9926
commit
729b0e25be
1 file changed
+1
-1
@@ -98,7 +98,7 @@ private:
|
||||
auto digest = m_inner_hasher.digest();
|
||||
// FIXME: should we check if the hash function creates more data than its block size?
|
||||
key_buffer.overwrite(0, digest.immutable_data(), m_inner_hasher.digest_size());
|
||||
} else {
|
||||
} else if (length > 0) {
|
||||
key_buffer.overwrite(0, key, length);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user