crypto: fix signed/unsigned comparison warning
authorBen Noordhuis <info@bnoordhuis.nl>
Tue, 6 Aug 2013 13:36:12 +0000 (15:36 +0200)
committerBen Noordhuis <info@bnoordhuis.nl>
Tue, 6 Aug 2013 13:39:43 +0000 (15:39 +0200)
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

src/node_crypto_clienthello.cc

index 424b30e..b786942 100644 (file)
@@ -140,7 +140,7 @@ void ClientHelloParser::ParseExtension(ClientHelloParser::ExtensionType type,
       {
         if (len < 2)
           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)
           return;
         for (size_t offset = 2; offset < 2 + server_names_len; ) {