Index: native_client_sdk/src/libraries/nacl_io/host_resolver.cc |
diff --git a/native_client_sdk/src/libraries/nacl_io/host_resolver.cc b/native_client_sdk/src/libraries/nacl_io/host_resolver.cc |
index b8100a72b5cbadbf404c26945e54c16b119082c7..60f3098edb39985a65a1748b0c007f8a84259de0 100644 |
--- a/native_client_sdk/src/libraries/nacl_io/host_resolver.cc |
+++ b/native_client_sdk/src/libraries/nacl_io/host_resolver.cc |
@@ -2,9 +2,12 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+#define __STDC_LIMIT_MACROS |
+ |
#include "nacl_io/host_resolver.h" |
#include <assert.h> |
+#include <stdint.h> |
#include <stdlib.h> |
#include <string.h> |
@@ -231,7 +234,7 @@ int HostResolver::getaddrinfo(const char* node, |
if (service != NULL) { |
char* cp; |
port = strtol(service, &cp, 10); |
- if (port > 0 && port <= 65535 && *cp == '\0') { |
+ if (port >= 0 && port <= UINT16_MAX && *cp == '\0') { |
port = htons(port); |
} else { |
return EAI_SERVICE; |