Skip to content

Commit 661ec67

Browse files
committed
fixup! tls: validate ticket keys buffer
1 parent 72d211b commit 661ec67

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

test/parallel/test-tls-ticket-invalid-arg.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,18 @@ if (!common.hasCrypto) {
77
const assert = require('assert');
88
const tls = require('tls');
99

10-
[null, undefined, 0, 1, 1n, Symbol(), {}, [], true, false, ''].forEach(
11-
(arg) =>
12-
assert.throws(() => {
13-
new tls.Server().setTicketKeys(arg);
14-
}, /"buffer" argument must be an instance of Buffer, TypedArray, or DataView/)
15-
);
10+
const server = new tls.Server();
11+
12+
[null, undefined, 0, 1, 1n, Symbol(), {}, [], true, false, '', () => {}]
13+
.forEach((arg) =>
14+
assert.throws(
15+
() => server.setTicketKeys(arg),
16+
{ code: 'ERR_INVALID_ARG_TYPE' }
17+
));
1618

1719
[new Uint8Array(1), Buffer.from([1]), new DataView(new ArrayBuffer(2))].forEach(
1820
(arg) =>
1921
assert.throws(() => {
20-
new tls.Server().setTicketKeys(arg);
22+
server.setTicketKeys(arg);
2123
}, /Session ticket keys must be a 48-byte buffer/)
2224
);

0 commit comments

Comments
 (0)