summaryrefslogtreecommitdiff
path: root/Libraries/LibTLS
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2020-08-11 23:30:06 +0430
committerAndreas Kling <kling@serenityos.org>2020-08-11 21:37:10 +0200
commit880b0a760029a060b8601ad0b64d004923ba1b52 (patch)
tree6fda2fd642127e7930e0c5ce39be9e192b223355 /Libraries/LibTLS
parentbc7a149039538f26e10444f38db6682d5df57333 (diff)
downloadserenity-880b0a760029a060b8601ad0b64d004923ba1b52.zip
LibTLS: Avoid extra initialisation of buffers that are initialised
A trace for proof: buffer: L91: 0:(packet.size() - header_size) L98: (packet.size() - header_size):(packet.size() - header_size + mac_size) L102: (packet.size() - header_size + mac_size):buffer.size() (asserted at L103) ct: L88: 0:(header_size - 2) L123: (header_size - 2):(header_size) L111: (header_size):(header_size + iv_size) L117: (header_size + iv_size):(header_size + iv_size + length) (asserted at L113)
Diffstat (limited to 'Libraries/LibTLS')
-rw-r--r--Libraries/LibTLS/Record.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Libraries/LibTLS/Record.cpp b/Libraries/LibTLS/Record.cpp
index 4d6f534c38..7e655df893 100644
--- a/Libraries/LibTLS/Record.cpp
+++ b/Libraries/LibTLS/Record.cpp
@@ -77,12 +77,12 @@ void TLSv12::update_packet(ByteBuffer& packet)
if (m_context.crypto.created == 1) {
// `buffer' will continue to be encrypted
- auto buffer = ByteBuffer::create_zeroed(length);
+ auto buffer = ByteBuffer::create_uninitialized(length);
size_t buffer_position = 0;
auto iv_size = iv_length();
// We need enough space for a header, iv_length bytes of IV and whatever the packet contains
- auto ct = ByteBuffer::create_zeroed(length + header_size + iv_size);
+ auto ct = ByteBuffer::create_uninitialized(length + header_size + iv_size);
// copy the header over
ct.overwrite(0, packet.data(), header_size - 2);