Stop a thrown listener escaping, bound what a peer can pin, and drop the body from failure responses

This commit is contained in:
2026-08-27 10:55:34 +02:00
parent 5af75a3c57
commit 884afdb87b
17 changed files with 420 additions and 87 deletions
+8
View File
@@ -49,6 +49,14 @@ describe('string (Octet String)', () => {
assert.deepEqual(types.string.read(encoded, 0), { bytesRead: 9, value: expected });
});
// The length is one octet, so a longer value has nowhere to say how long it is.
test('refuses a value longer than the length octet can count', () => {
const tooLong = 'x'.repeat(256);
assert.ok(types.string.size(tooLong).err instanceof Error);
assert.ok(types.string.write(tooLong, Buffer.alloc(300), 0).err instanceof Error);
});
test('sizes as the string plus its length octet', () => {
assert.deepEqual(types.string.size(expected), { size: 9 });
});