Skip to content

Commit 377e8ce

Browse files
codebytereaduh95
authored andcommitted
tls: avoid external memory leak on invalid protocol versions
PR-URL: #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>
1 parent 4a5d7a4 commit 377e8ce

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎lib/internal/tls/common.js‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,11 @@ function SecureContext(secureProtocol, secureOptions, minVersion, maxVersion) {
8282
thrownewERR_TLS_PROTOCOL_VERSION_CONFLICT(maxVersion,secureProtocol);
8383
}
8484

85+
constminV=toV('minimum',minVersion,tls.DEFAULT_MIN_VERSION);
86+
constmaxV=toV('maximum',maxVersion,tls.DEFAULT_MAX_VERSION);
87+
8588
this.context=newNativeSecureContext();
86-
this.context.init(secureProtocol,
87-
toV('minimum',minVersion,tls.DEFAULT_MIN_VERSION),
88-
toV('maximum',maxVersion,tls.DEFAULT_MAX_VERSION));
89+
this.context.init(secureProtocol,minV,maxV);
8990

9091
if(secureOptions){
9192
validateInteger(secureOptions,'secureOptions');

0 commit comments

Comments
 (0)