Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tls: avoid throw in onerror for bad TLSSocket obj #41523

Merged
merged 1 commit into from Feb 14, 2022

Commits on Jan 14, 2022

  1. tls: avoid throw in onerror for bad TLSSocket obj

    TLSWrap.onerror has a helpful debug() call built in to it. However in
    case of a malformed TLSSocket object, where the `_tlsOptions` value is
    an unexpected `undefined`, accessing `_tlsOptions.isServer` causes
    a TypeError to be thrown.
    
    This commit ensures that the debug() call properly logs the state as
    'unknown', instead of the two 'server' and 'client' choices previously
    available. Additionally, onerror branching is adjusted to allow such
    `undefined` options object, by use of optional chaining.
    
    Other methods are not being adjusted, as such a case of `undefined`
    options is not viable during regular processing of the TLSSocket.
    
    Fixes: nodejs#41501
    sigv committed Jan 14, 2022
    Copy the full SHA
    653c392 View commit details
    Browse the repository at this point in the history