From 612408480775b50b6829945ed99780656d420a60 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 12 Jan 2015 14:31:45 -1000 Subject: [PATCH] Bring padding calculation in-line with android --- js/protocol.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/protocol.js b/js/protocol.js index 69ac2431..42ffe860 100644 --- a/js/protocol.js +++ b/js/protocol.js @@ -626,7 +626,7 @@ window.textsecure.protocol = function() { var msg = new textsecure.protobuf.WhisperMessage(); var plaintext = toArrayBuffer(pushMessageContent.encode()); - var paddedPlaintext = new Uint8Array(Math.ceil((plaintext.byteLength + 1) / 160.0) * 160); + var paddedPlaintext = new Uint8Array(Math.ceil((plaintext.byteLength + 1) / 160.0) * 160 - 1); paddedPlaintext.set(new Uint8Array(plaintext)); paddedPlaintext[plaintext.byteLength] = 0x80;