diff options
author | Tobias Nießen <tniessen@tnie.de> | 2018-09-27 20:10:15 +0200 |
---|---|---|
committer | Tobias Nießen <tniessen@tnie.de> | 2018-10-01 20:36:22 +0200 |
commit | 640172d24d299aebed2a95bdaa3905a6d8350643 (patch) | |
tree | b34cc5b5b9495c569aa9b72120b58a19f89b3324 /src/node_crypto_clienthello.cc | |
parent | 6ea507a8bf363b549a2630db25cc82cd71ec18fc (diff) | |
download | android-node-v8-640172d24d299aebed2a95bdaa3905a6d8350643.tar.gz android-node-v8-640172d24d299aebed2a95bdaa3905a6d8350643.tar.bz2 android-node-v8-640172d24d299aebed2a95bdaa3905a6d8350643.zip |
crypto: replace gotos
PR-URL: https://github.com/nodejs/node/pull/23132
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_crypto_clienthello.cc')
-rw-r--r-- | src/node_crypto_clienthello.cc | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/node_crypto_clienthello.cc b/src/node_crypto_clienthello.cc index 4df0d93482..cbe1be3273 100644 --- a/src/node_crypto_clienthello.cc +++ b/src/node_crypto_clienthello.cc @@ -74,12 +74,6 @@ bool ClientHelloParser::ParseRecordHeader(const uint8_t* data, size_t avail) { void ClientHelloParser::ParseHeader(const uint8_t* data, size_t avail) { ClientHello hello; - bool failed = true; - - OnScopeLeave cleanup([&]() { - if (failed) - End(); - }); // >= 5 + frame size bytes for frame parsing if (body_offset_ + frame_len_ > avail) @@ -94,23 +88,23 @@ void ClientHelloParser::ParseHeader(const uint8_t* data, size_t avail) { if (data[body_offset_ + 4] != 0x03 || data[body_offset_ + 5] < 0x01 || data[body_offset_ + 5] > 0x03) { - return; + return End(); } if (data[body_offset_] == kClientHello) { if (state_ == kTLSHeader) { if (!ParseTLSClientHello(data, avail)) - return; + return End(); } else { // We couldn't get here, but whatever - return; + return End(); } // Check if we overflowed (do not reply with any private data) if (session_id_ == nullptr || session_size_ > 32 || session_id_ + session_size_ > data + avail) { - return; + return End(); } } @@ -122,8 +116,6 @@ void ClientHelloParser::ParseHeader(const uint8_t* data, size_t avail) { hello.servername_ = servername_; hello.servername_size_ = static_cast<uint8_t>(servername_size_); onhello_cb_(cb_arg_, hello); - failed = false; - return; } |