From 450e35d2a333a6883c4a7444d9687e9ebd1160dd Mon Sep 17 00:00:00 2001 From: David Reiss Date: Tue, 9 Mar 2010 05:19:41 +0000 Subject: [PATCH] cpp: Fix max TCP port number git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920671 13f79535-47bb-0310-9956-ffa450edef68 --- lib/cpp/src/transport/TSocket.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cpp/src/transport/TSocket.cpp b/lib/cpp/src/transport/TSocket.cpp index f99a6ff0..55e8dc32 100644 --- a/lib/cpp/src/transport/TSocket.cpp +++ b/lib/cpp/src/transport/TSocket.cpp @@ -230,7 +230,7 @@ void TSocket::open() { } // Validate port number - if (port_ < 0 || port_ > 65536) { + if (port_ < 0 || port_ > 0xFFFF) { throw TTransportException(TTransportException::NOT_OPEN, "Specified port is invalid"); } @@ -238,7 +238,7 @@ void TSocket::open() { res = NULL; res0 = NULL; int error; - char port[sizeof("65536")]; + char port[sizeof("65535")]; std::memset(&hints, 0, sizeof(hints)); hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_STREAM; -- 2.17.1