diff --git a/js/libtextsecure.js b/js/libtextsecure.js index 51689d82..93243964 100644 --- a/js/libtextsecure.js +++ b/js/libtextsecure.js @@ -37873,8 +37873,10 @@ axolotlInternal.RecipientRecord = function() { }, handlePreKeyWhisperMessage: function(from, blob) { blob.mark(); - if (blob.readUint8() != ((3 << 4) | 3)) { - throw new Error("Bad version byte"); + var version = blob.readUint8(); + if ((version & 0xF) > 3 || (version >> 4) < 3) { + // min version > 3 or max version < 3 + throw new Error("Incompatible version byte"); } return axolotlInstance.handlePreKeyWhisperMessage(from, blob).catch(function(e) { if (e.message === 'Unknown identity key') { diff --git a/libtextsecure/axolotl_wrapper.js b/libtextsecure/axolotl_wrapper.js index a3531524..b5462944 100644 --- a/libtextsecure/axolotl_wrapper.js +++ b/libtextsecure/axolotl_wrapper.js @@ -37,8 +37,10 @@ }, handlePreKeyWhisperMessage: function(from, blob) { blob.mark(); - if (blob.readUint8() != ((3 << 4) | 3)) { - throw new Error("Bad version byte"); + var version = blob.readUint8(); + if ((version & 0xF) > 3 || (version >> 4) < 3) { + // min version > 3 or max version < 3 + throw new Error("Incompatible version byte"); } return axolotlInstance.handlePreKeyWhisperMessage(from, blob).catch(function(e) { if (e.message === 'Unknown identity key') {