From 3be9a9ac7630ffdecd8bf2bfb741e2b92550507d Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 26 Dec 2020 16:06:27 +0100 Subject: [PATCH] LibTLS: Fix TLS breakage after ByteBuffer => Span conversion Oops, I accidentally shadowed the outer scope's "decrypted" ByteBuffer which caused us to throw away the buffer too early. Fixes #4533. --- Libraries/LibTLS/Record.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/LibTLS/Record.cpp b/Libraries/LibTLS/Record.cpp index fe306949ec..913b7ab81c 100644 --- a/Libraries/LibTLS/Record.cpp +++ b/Libraries/LibTLS/Record.cpp @@ -343,7 +343,7 @@ ssize_t TLSv12::handle_message(ReadonlyBytes buffer) ASSERT(m_aes_remote.cbc); auto iv_size = iv_length(); - auto decrypted = m_aes_remote.cbc->create_aligned_buffer(length - iv_size); + decrypted = m_aes_remote.cbc->create_aligned_buffer(length - iv_size); auto iv = buffer.slice(header_size, iv_size); Bytes decrypted_span = decrypted; @@ -383,7 +383,7 @@ ssize_t TLSv12::handle_message(ReadonlyBytes buffer) return (i8)Error::IntegrityCheckFailed; } - plain = decrypted.slice(0, length); + plain = decrypted.bytes().slice(0, length); } } m_context.remote_sequence_number++;