diff options
author | Sam Roberts <vieuxtech@gmail.com> | 2019-02-01 10:57:04 -0800 |
---|---|---|
committer | Sam Roberts <vieuxtech@gmail.com> | 2019-02-04 08:06:41 -0800 |
commit | 6b7c402518d4b77687584eba2a9284674962f343 (patch) | |
tree | 5bf42b6dd9b5b470d507d8f6a17bf9247f870648 /lib/_tls_wrap.js | |
parent | c6ecbd36faa3ddf3cc174609e8522d9faa69812c (diff) | |
download | android-node-v8-6b7c402518d4b77687584eba2a9284674962f343.tar.gz android-node-v8-6b7c402518d4b77687584eba2a9284674962f343.tar.bz2 android-node-v8-6b7c402518d4b77687584eba2a9284674962f343.zip |
tls: check arg types of renegotiate()
Don't throw on invalid property access if options is not provided, and
ensure callback is a function.
PR-URL: https://github.com/nodejs/node/pull/25876
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'lib/_tls_wrap.js')
-rw-r--r-- | lib/_tls_wrap.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index 9d47c9c2ba..e041c12578 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -39,6 +39,7 @@ const { owner_symbol } = require('internal/async_hooks').symbols; const { SecureContext: NativeSecureContext } = internalBinding('crypto'); const { ERR_INVALID_ARG_TYPE, + ERR_INVALID_CALLBACK, ERR_MULTIPLE_CALLBACK, ERR_SOCKET_CLOSED, ERR_TLS_DH_PARAM_SIZE, @@ -581,6 +582,11 @@ TLSSocket.prototype._init = function(socket, wrap) { }; TLSSocket.prototype.renegotiate = function(options, callback) { + if (options === null || typeof options !== 'object') + throw new ERR_INVALID_ARG_TYPE('options', 'Object', options); + if (callback != null && typeof callback !== 'function') + throw new ERR_INVALID_CALLBACK(); + if (this.destroyed) return; |