aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-06-23 15:15:18 +0100
committerMark Haines <mark.haines@matrix.org>2015-06-23 15:15:18 +0100
commit10e7e8123dac04d62897f29cdbd17e397cc2e854 (patch)
treebb29e050ae800a00d44a9aa2b592ce463989e61c
parent39a08733094a4dc0870b9a36c182b4009f7811c1 (diff)
Add missing include, fix bug in handling unknown message fields
-rw-r--r--include/axolotl/cipher.hh1
-rw-r--r--src/message.cpp8
2 files changed, 5 insertions, 4 deletions
diff --git a/include/axolotl/cipher.hh b/include/axolotl/cipher.hh
index 93974fd..5a077aa 100644
--- a/include/axolotl/cipher.hh
+++ b/include/axolotl/cipher.hh
@@ -17,6 +17,7 @@
#define AXOLOTL_CIPHER_HH_
#include <cstdint>
+#include <cstddef>
namespace axolotl {
diff --git a/src/message.cpp b/src/message.cpp
index 6ce8ca6..7eea4c2 100644
--- a/src/message.cpp
+++ b/src/message.cpp
@@ -140,10 +140,10 @@ std::uint8_t const * skip_unknown(
) {
if (pos != end) {
uint8_t tag = *pos;
- if (tag & 0x7 == 0) {
+ if ((tag & 0x7) == 0) {
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);
std::uint8_t const * len_start = pos;
pos = varint_skip(pos, end);
@@ -222,7 +222,7 @@ void axolotl::decode_message(
reader.ciphertext, reader.ciphertext_length
);
if (unknown == pos) {
- pos == skip_unknown(pos, end);
+ pos = skip_unknown(pos, end);
}
unknown = pos;
}
@@ -305,7 +305,7 @@ void axolotl::decode_one_time_key_message(
reader.message, reader.message_length
);
if (unknown == pos) {
- pos == skip_unknown(pos, end);
+ pos = skip_unknown(pos, end);
}
unknown = pos;
}