diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2021-09-06 03:28:46 +0430 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-06 01:53:26 +0200 |
commit | 3a9f00c59bad7735970c72cb940d08161fda09b0 (patch) | |
tree | 5eebf972a2a3b3c2e73d40068f4d58c9d6368764 /Userland/Libraries/LibCrypto/PK | |
parent | 6606993432273959d7b2e1815646ee8a54025103 (diff) | |
download | serenity-3a9f00c59bad7735970c72cb940d08161fda09b0.zip |
Everywhere: Use OOM-safe ByteBuffer APIs where possible
If we can easily communicate failure, let's avoid asserting and report
failure instead.
Diffstat (limited to 'Userland/Libraries/LibCrypto/PK')
-rw-r--r-- | Userland/Libraries/LibCrypto/PK/Code/EMSA_PSS.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Userland/Libraries/LibCrypto/PK/Code/EMSA_PSS.h b/Userland/Libraries/LibCrypto/PK/Code/EMSA_PSS.h index 2b5e89c1a2..1f99484d9d 100644 --- a/Userland/Libraries/LibCrypto/PK/Code/EMSA_PSS.h +++ b/Userland/Libraries/LibCrypto/PK/Code/EMSA_PSS.h @@ -151,7 +151,10 @@ public: for (size_t counter = 0; counter < length / HashFunction::DigestSize - 1; ++counter) { hash_fn.update(seed); hash_fn.update((u8*)&counter, 4); - T.append(hash_fn.digest().data, HashFunction::DigestSize); + if (!T.try_append(hash_fn.digest().data, HashFunction::DigestSize)) { + dbgln("EMSA_PSS: MGF1 digest failed, not enough space"); + return; + } } out.overwrite(0, T.data(), length); } |