Skip to content

Commit

Permalink
tls_legacy: do not read on OpenSSL's stack
Browse files Browse the repository at this point in the history
Do not attempt to read data from the socket whilst on OpenSSL's stack,
weird things may happen, and this is most likely going to result in some
kind of error.

PR-URL: #4624
Reviewed-By: Trevor Norris <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
indutny authored and Myles Borins committed Feb 15, 2016
1 parent d71f999 commit 7821b3e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/_tls_legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -614,13 +614,15 @@ function onclienthello(hello) {

if (err) return self.socket.destroy(err);

self.ssl.loadSession(session);
self.ssl.endParser();
setImmediate(function() {
self.ssl.loadSession(session);
self.ssl.endParser();

// Cycle data
self._resumingSession = false;
self.cleartext.read(0);
self.encrypted.read(0);
// Cycle data
self._resumingSession = false;
self.cleartext.read(0);
self.encrypted.read(0);
});
}

if (hello.sessionId.length <= 0 ||
Expand Down

0 comments on commit 7821b3e

Please sign in to comment.