aboutsummaryrefslogtreecommitdiff
path: root/src/message.cpp
diff options
context:
space:
mode:
authorpedroGitt <pedro.contreiras@amdocs.com>2016-11-23 00:04:58 +0100
committerpedroGitt <pedro.contreiras@amdocs.com>2016-11-23 00:04:58 +0100
commit7a6897642baa8fc5d9d9f14c80fc4f201cfe2173 (patch)
tree9325a7d7d3ac40747f49af22378dcf9bc5c0dd0b /src/message.cpp
parentc725a561a283f508e68516ded86d141214f5ea06 (diff)
parentf6c05be8c5d35e725a8a2ed5ad661398ac9f8cd2 (diff)
Merge remote-tracking branch 'origin/master' into pedroc/android_e2e_dev
Diffstat (limited to 'src/message.cpp')
-rw-r--r--src/message.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/message.cpp b/src/message.cpp
index 05fe2c7..1c11a4a 100644
--- a/src/message.cpp
+++ b/src/message.cpp
@@ -214,11 +214,13 @@ void olm::decode_message(
reader.ciphertext = nullptr;
reader.ciphertext_length = 0;
- if (pos == end) return;
if (input_length < mac_length) return;
+
+ if (pos == end) return;
reader.version = *(pos++);
while (pos != end) {
+ unknown = pos;
pos = decode(
pos, end, RATCHET_KEY_TAG,
reader.ratchet_key, reader.ratchet_key_length
@@ -234,7 +236,6 @@ void olm::decode_message(
if (unknown == pos) {
pos = skip_unknown(pos, end);
}
- unknown = pos;
}
}
@@ -303,6 +304,7 @@ void olm::decode_one_time_key_message(
reader.version = *(pos++);
while (pos != end) {
+ unknown = pos;
pos = decode(
pos, end, ONE_TIME_KEY_ID_TAG,
reader.one_time_key, reader.one_time_key_length
@@ -322,7 +324,6 @@ void olm::decode_one_time_key_message(
if (unknown == pos) {
pos = skip_unknown(pos, end);
}
- unknown = pos;
}
}
@@ -377,9 +378,12 @@ void _olm_decode_group_message(
results->ciphertext_length = 0;
if (input_length < trailer_length) return;
+
+ if (pos == end) return;
results->version = *(pos++);
while (pos != end) {
+ unknown = pos;
pos = decode(
pos, end, GROUP_MESSAGE_INDEX_TAG,
results->message_index, has_message_index
@@ -391,7 +395,6 @@ void _olm_decode_group_message(
if (unknown == pos) {
pos = skip_unknown(pos, end);
}
- unknown = pos;
}
results->has_message_index = (int)has_message_index;