mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
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)
This commit is contained in:
parent
bc7a149039
commit
880b0a7600
Notes:
sideshowbarker
2024-07-19 03:52:47 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/880b0a76002 Pull-request: https://github.com/SerenityOS/serenity/pull/3094 Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/nico
1 changed files with 2 additions and 2 deletions
|
@ -77,12 +77,12 @@ void TLSv12::update_packet(ByteBuffer& packet)
|
||||||
|
|
||||||
if (m_context.crypto.created == 1) {
|
if (m_context.crypto.created == 1) {
|
||||||
// `buffer' will continue to be encrypted
|
// `buffer' will continue to be encrypted
|
||||||
auto buffer = ByteBuffer::create_zeroed(length);
|
auto buffer = ByteBuffer::create_uninitialized(length);
|
||||||
size_t buffer_position = 0;
|
size_t buffer_position = 0;
|
||||||
auto iv_size = iv_length();
|
auto iv_size = iv_length();
|
||||||
|
|
||||||
// We need enough space for a header, iv_length bytes of IV and whatever the packet contains
|
// 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
|
// copy the header over
|
||||||
ct.overwrite(0, packet.data(), header_size - 2);
|
ct.overwrite(0, packet.data(), header_size - 2);
|
||||||
|
|
Loading…
Reference in a new issue