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..c16fbcb16d2475839a3bb93fd59f8c81489915ff 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,14 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+#ifndef __STDC_LIMIT_MACROS |
+#define __STDC_LIMIT_MACROS |
+#endif |
+ |
#include "nacl_io/host_resolver.h" |
#include <assert.h> |
+#include <stdint.h> |
#include <stdlib.h> |
#include <string.h> |
@@ -231,7 +236,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; |