Browse Source

crypto: fix signed/unsigned comparison warning

The type of the expression `(uint16_t) server_names_len + 2` gets
implicitly widened to int. Change the type of server_names_len to
uint32_t to avoid the following warnings:

    ../../src/node_crypto_clienthello.cc:144: warning: comparison
    between signed and unsigned integer expressions
    ../../src/node_crypto_clienthello.cc:146: warning: comparison
    between signed and unsigned integer expressions
v0.11.5-release
Ben Noordhuis 12 years ago
parent
commit
576496632c
  1. 2
      src/node_crypto_clienthello.cc

2
src/node_crypto_clienthello.cc

@ -140,7 +140,7 @@ void ClientHelloParser::ParseExtension(ClientHelloParser::ExtensionType type,
{ {
if (len < 2) if (len < 2)
return; return;
uint16_t server_names_len = (data[0] << 8) + data[1]; uint32_t server_names_len = (data[0] << 8) + data[1];
if (server_names_len + 2 > len) if (server_names_len + 2 > len)
return; return;
for (size_t offset = 2; offset < 2 + server_names_len; ) { for (size_t offset = 2; offset < 2 + server_names_len; ) {

Loading…
Cancel
Save