From 3abd3137c77c97ddbaa8e344588f139ba1efa4f6 Mon Sep 17 00:00:00 2001 From: Travis Ralston <travpc@gmail.com> Date: Wed, 26 Feb 2020 13:37:19 -0700 Subject: [PATCH] Use the right function for creating binary verification QR codes `writeInt8` happened to work because the strings we're writing happen to fit within a single byte so the LSB doesn't matter. We actually want a 16 bit (2 byte) number in big-endian format. --- src/components/views/elements/crypto/VerificationQRCode.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/elements/crypto/VerificationQRCode.js b/src/components/views/elements/crypto/VerificationQRCode.js index b7232048e5..3838aa61ff 100644 --- a/src/components/views/elements/crypto/VerificationQRCode.js +++ b/src/components/views/elements/crypto/VerificationQRCode.js @@ -127,7 +127,7 @@ export default class VerificationQRCode extends React.PureComponent { }; const appendInt = (i: number) => { const tmpBuf = Buffer.alloc(2); - tmpBuf.writeInt8(i, 0); + tmpBuf.writeInt16BE(i, 0); buf = Buffer.concat([buf, tmpBuf]); }; const appendStr = (s: string, enc: string, withLengthPrefix = true) => {