fix: AES key generation out of bounds (#1596)

This commit is contained in:
WLK
2026-01-26 09:46:22 +01:00
committed by GitHub
parent 397dacc51a
commit 2e3a3e7240
+1 -1
View File
@@ -14,7 +14,7 @@ const uint8ArrayToHex = (arr) =>
function stdAESKey(key) { function stdAESKey(key) {
const tKey = new TextEncoder().encode(key); const tKey = new TextEncoder().encode(key);
let sk = tKey; let sk = tKey;
if (key.length < 32) { if (tKey.length < 32) {
sk = new Uint8Array(32); sk = new Uint8Array(32);
sk.set(tKey); sk.set(tKey);
sk.set(defaultAESKey.slice(key.length, 32), key.length); sk.set(defaultAESKey.slice(key.length, 32), key.length);