crypto: fix undefined behavior in ParseExtension · nodejs/node@c9f6776

Original file line numberDiff line numberDiff line change

@@ -103,7 +103,7 @@ void ClientHelloParser::ParseHeader(const uint8_t* data, size_t avail) {

103103

}

104104
105105
106-

void ClientHelloParser::ParseExtension(ClientHelloParser::ExtensionType type,

106+

void ClientHelloParser::ParseExtension(const uint16_t type,

107107

const uint8_t* data,

108108

size_t len) {

109109

// 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) {

210210

if (ext_off + ext_len > avail)

211211

return false;

212212
213-

ParseExtension(static_cast<ExtensionType>(ext_type),

213+

ParseExtension(ext_type,

214214

data + ext_off,

215215

ext_len);

216216