From 57192699fa629d6b03eed0f7b38d0d7682b34abe Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Wed, 19 May 2021 10:04:51 +1000 Subject: [PATCH] attachment padding not enforced to be 0x00 (#1640) --- ts/session/crypto/BufferPadding.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/ts/session/crypto/BufferPadding.ts b/ts/session/crypto/BufferPadding.ts index 5658cd7c0..50a2edf73 100644 --- a/ts/session/crypto/BufferPadding.ts +++ b/ts/session/crypto/BufferPadding.ts @@ -65,13 +65,7 @@ export function getUnpaddedAttachment( if (data.byteLength <= unpaddedExpectedSize) { return null; } - const dataUint = new Uint8Array(data); - for (let i = unpaddedExpectedSize; i < data.byteLength; i++) { - if (dataUint[i] !== PADDING_BYTE) { - return null; - } - } - + // we know consider that anything coming after the expected size is padding, no matter what there is there return data.slice(0, unpaddedExpectedSize); }