Add missing include, fix bug in handling unknown message fields

This commit is contained in:
Mark Haines 2015-06-23 15:15:18 +01:00
parent 39a0873309
commit 10e7e8123d
2 changed files with 5 additions and 4 deletions

View file

@ -17,6 +17,7 @@
#define AXOLOTL_CIPHER_HH_ #define AXOLOTL_CIPHER_HH_
#include <cstdint> #include <cstdint>
#include <cstddef>
namespace axolotl { namespace axolotl {

View file

@ -140,10 +140,10 @@ std::uint8_t const * skip_unknown(
) { ) {
if (pos != end) { if (pos != end) {
uint8_t tag = *pos; uint8_t tag = *pos;
if (tag & 0x7 == 0) { if ((tag & 0x7) == 0) {
pos = varint_skip(pos, end); pos = varint_skip(pos, end);
pos = varint_skip(pos, end); pos = varint_skip(pos, end);
} else if (tag & 0x7 == 2) { } else if ((tag & 0x7) == 2) {
pos = varint_skip(pos, end); pos = varint_skip(pos, end);
std::uint8_t const * len_start = pos; std::uint8_t const * len_start = pos;
pos = varint_skip(pos, end); pos = varint_skip(pos, end);
@ -222,7 +222,7 @@ void axolotl::decode_message(
reader.ciphertext, reader.ciphertext_length reader.ciphertext, reader.ciphertext_length
); );
if (unknown == pos) { if (unknown == pos) {
pos == skip_unknown(pos, end); pos = skip_unknown(pos, end);
} }
unknown = pos; unknown = pos;
} }
@ -305,7 +305,7 @@ void axolotl::decode_one_time_key_message(
reader.message, reader.message_length reader.message, reader.message_length
); );
if (unknown == pos) { if (unknown == pos) {
pos == skip_unknown(pos, end); pos = skip_unknown(pos, end);
} }
unknown = pos; unknown = pos;
} }