mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
tls: avoid external memory leak on invalid protocol versions
PR-URL: https://github.com/nodejs/node/pull/60390 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
@@ -82,10 +82,11 @@ function SecureContext(secureProtocol, secureOptions, minVersion, maxVersion) {
|
||||
throw new ERR_TLS_PROTOCOL_VERSION_CONFLICT(maxVersion, secureProtocol);
|
||||
}
|
||||
|
||||
const minV = toV('minimum', minVersion, tls.DEFAULT_MIN_VERSION);
|
||||
const maxV = toV('maximum', maxVersion, tls.DEFAULT_MAX_VERSION);
|
||||
|
||||
this.context = new NativeSecureContext();
|
||||
this.context.init(secureProtocol,
|
||||
toV('minimum', minVersion, tls.DEFAULT_MIN_VERSION),
|
||||
toV('maximum', maxVersion, tls.DEFAULT_MAX_VERSION));
|
||||
this.context.init(secureProtocol, minV, maxV);
|
||||
|
||||
if (secureOptions) {
|
||||
validateInteger(secureOptions, 'secureOptions');
|
||||
|
||||
Reference in New Issue
Block a user