mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
crypto: fix undefined behavior in ParseExtension
Many extensions are unknown to the `ClientHelloParser::ParseExtension`, do not cast user-supplied `uint16_t` to `enum`. PR-URL: https://github.com/nodejs/node/pull/7494 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
1 parent
46f40cfb4c
commit
c9f6776d2b
2 files changed
+3
-3
No files matched your search
@@ -103,7 +103,7 @@ void ClientHelloParser::ParseHeader(const uint8_t* data, size_t avail) {
|
||||
}
|
||||
|
||||
|
||||
void ClientHelloParser::ParseExtension(ClientHelloParser::ExtensionType type,
|
||||
void ClientHelloParser::ParseExtension(const uint16_t type,
|
||||
const uint8_t* data,
|
||||
size_t len) {
|
||||
// NOTE: In case of anything we're just returning back, ignoring the problem.
|
||||
@@ -210,7 +210,7 @@ bool ClientHelloParser::ParseTLSClientHello(const uint8_t* data, size_t avail) {
|
||||
if (ext_off + ext_len > avail)
|
||||
return false;
|
||||
|
||||
ParseExtension(static_cast<ExtensionType>(ext_type),
|
||||
ParseExtension(ext_type,
|
||||
data + ext_off,
|
||||
ext_len);
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ class ClientHelloParser {
|
||||
|
||||
bool ParseRecordHeader(const uint8_t* data, size_t avail);
|
||||
void ParseHeader(const uint8_t* data, size_t avail);
|
||||
void ParseExtension(ExtensionType type,
|
||||
void ParseExtension(const uint16_t type,
|
||||
const uint8_t* data,
|
||||
size_t len);
|
||||
bool ParseTLSClientHello(const uint8_t* data, size_t avail);
|
||||
|
||||
Reference in new issue
Block a user