summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibTLS/TLSv12.cpp
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2021-09-06 03:28:46 +0430
committerAndreas Kling <kling@serenityos.org>2021-09-06 01:53:26 +0200
commit3a9f00c59bad7735970c72cb940d08161fda09b0 (patch)
tree5eebf972a2a3b3c2e73d40068f4d58c9d6368764 /Userland/Libraries/LibTLS/TLSv12.cpp
parent6606993432273959d7b2e1815646ee8a54025103 (diff)
downloadserenity-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/LibTLS/TLSv12.cpp')
-rw-r--r--Userland/Libraries/LibTLS/TLSv12.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/Userland/Libraries/LibTLS/TLSv12.cpp b/Userland/Libraries/LibTLS/TLSv12.cpp
index 059da14cde..8c5273e557 100644
--- a/Userland/Libraries/LibTLS/TLSv12.cpp
+++ b/Userland/Libraries/LibTLS/TLSv12.cpp
@@ -35,7 +35,10 @@ void TLSv12::consume(ReadonlyBytes record)
dbgln_if(TLS_DEBUG, "Consuming {} bytes", record.size());
- m_context.message_buffer.append(record.data(), record.size());
+ if (!m_context.message_buffer.try_append(record.data(), record.size())) {
+ dbgln("Not enough space in message buffer, dropping the record");
+ return;
+ }
size_t index { 0 };
size_t buffer_length = m_context.message_buffer.size();