cpp: Fix max TCP port number
authorDavid Reiss <dreiss@apache.org>
Tue, 9 Mar 2010 05:19:41 +0000 (05:19 +0000)
committerDavid Reiss <dreiss@apache.org>
Tue, 9 Mar 2010 05:19:41 +0000 (05:19 +0000)
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920671 13f79535-47bb-0310-9956-ffa450edef68

lib/cpp/src/transport/TSocket.cpp

index f99a6ff..55e8dc3 100644 (file)
@@ -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;