From a5efc08ef3dd2b31e3af4e90868ddf79c7b49f6e Mon Sep 17 00:00:00 2001 From: Denis Kasak Date: Tue, 11 May 2021 13:15:27 +0200 Subject: [PATCH] olm: Also initialize all fields when decoding Olm messages. As a precaution. --- src/message.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/message.cpp b/src/message.cpp index 52d12bd..e5e63f0 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -206,9 +206,11 @@ void olm::decode_message( std::uint8_t const * end = input + input_length - mac_length; std::uint8_t const * unknown = nullptr; + reader.version = 0; + reader.has_counter = false; + reader.counter = 0; reader.input = input; reader.input_length = input_length; - reader.has_counter = false; reader.ratchet_key = nullptr; reader.ratchet_key_length = 0; reader.ciphertext = nullptr; @@ -291,6 +293,7 @@ void olm::decode_one_time_key_message( std::uint8_t const * end = input + input_length; std::uint8_t const * unknown = nullptr; + reader.version = 0; reader.one_time_key = nullptr; reader.one_time_key_length = 0; reader.identity_key = nullptr;