Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Jodat-Danbrani <andre.jodat-danbrani@xe.com>2018-10-12 21:44:10 +0300
committerRich Trott <rtrott@gmail.com>2018-10-24 07:05:47 +0300
commitcdba3c1de0de37576426421128982a4022480381 (patch)
tree9d6a4f455d6444fc8131a4cf1e31fcf506942754 /test/parallel/test-tls-basic-validations.js
parent51cd9719b5fde5da973dcdbb196402b49f885c63 (diff)
tls: throw if protocol too long
The convertProtocols() function now throws a range error when the byte length of a protocol is too long to fit in a Buffer. Also added a test case in test/parallel/test-tls-basic-validations.js to cover this. PR-URL: https://github.com/nodejs/node/pull/23606 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Diffstat (limited to 'test/parallel/test-tls-basic-validations.js')
-rw-r--r--test/parallel/test-tls-basic-validations.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/parallel/test-tls-basic-validations.js b/test/parallel/test-tls-basic-validations.js
index d0082edb463..8d39b8d45c9 100644
--- a/test/parallel/test-tls-basic-validations.js
+++ b/test/parallel/test-tls-basic-validations.js
@@ -102,3 +102,16 @@ common.expectsError(
assert(out.ALPNProtocols.equals(Buffer.from(expectView)));
}
}
+
+{
+ const protocols = [(new String('a')).repeat(500)];
+ const out = {};
+ common.expectsError(
+ () => tls.convertALPNProtocols(protocols, out),
+ {
+ code: 'ERR_OUT_OF_RANGE',
+ message: 'The byte length of the protocol at index 0 exceeds the ' +
+ 'maximum length. It must be <= 255. Received 500'
+ }
+ );
+}