Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Unified Diff: native_client_sdk/src/libraries/nacl_io/host_resolver.cc

Issue 344833005: [NaCl SDK] nacl_io: Fix bug in getaddrinfo() where service is "0" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698