From: David Reiss Date: Tue, 9 Mar 2010 05:19:41 +0000 (+0000) Subject: cpp: Fix max TCP port number X-Git-Tag: 0.3.0~88 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=450e35d2a333a6883c4a7444d9687e9ebd1160dd;p=common%2Fthrift.git cpp: Fix max TCP port number git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920671 13f79535-47bb-0310-9956-ffa450edef68 --- 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;