diff --git a/src/ssn/readSolidpkg.ts b/src/ssn/readSolidpkg.ts index 717ef91..f475008 100644 --- a/src/ssn/readSolidpkg.ts +++ b/src/ssn/readSolidpkg.ts @@ -85,7 +85,8 @@ export default function readSolidpkg(buffer: Buffer) { //read password from extra field let encodedPassword: Uint8Array | undefined; - while (pos + 4 <= extraFieldLength) { + const extraFieldEnd = pos + extraFieldLength; + while (pos + 4 <= extraFieldEnd) { const fieldId = dv.getUint16(pos, true); pos += 2; const fieldLength = dv.getUint16(pos, true); pos += 2; switch (fieldId) {