diff --git a/src/common/config/config.cpp b/src/common/config/config.cpp index e4d24b513b..45710bfaf2 100644 --- a/src/common/config/config.cpp +++ b/src/common/config/config.cpp @@ -395,9 +395,9 @@ const char *Config::getRemoteServiceName() return (const char*) sysConfig.values[KEY_REMOTE_SERVICE_NAME]; } -int Config::getRemoteServicePort() +unsigned short Config::getRemoteServicePort() { - return (int) sysConfig.values[KEY_REMOTE_SERVICE_PORT]; + return (unsigned short) sysConfig.values[KEY_REMOTE_SERVICE_PORT]; } const char *Config::getRemotePipeName() diff --git a/src/common/config/config.h b/src/common/config/config.h index 7454bc759f..1f5079b92e 100644 --- a/src/common/config/config.h +++ b/src/common/config/config.h @@ -245,7 +245,7 @@ public: /* Service port for INET */ - static int getRemoteServicePort(); + static unsigned short getRemoteServicePort(); /* Pipe name for WNET diff --git a/src/remote/inet.cpp b/src/remote/inet.cpp index fefff11350..47ce8fc8f6 100644 --- a/src/remote/inet.cpp +++ b/src/remote/inet.cpp @@ -41,7 +41,7 @@ * */ /* -$Id: inet.cpp,v 1.95 2004-01-03 10:59:46 robocop Exp $ +$Id: inet.cpp,v 1.96 2004-01-13 13:38:34 eku Exp $ */ #include "firebird.h" #include "../jrd/ib_stdio.h" @@ -777,11 +777,12 @@ PORT INET_connect(const TEXT* name, } if (!protocol) { - const int port = Config::getRemoteServicePort(); + const unsigned short port = Config::getRemoteServicePort(); const char* svc = Config::getRemoteServiceName(); if (port) { - snprintf(temp, sizeof(temp), "%d", port); - temp[sizeof(temp) - 1] = 0; + // EKU: since temp is 128 byte long, the port number will always + // fit into the buffer, hence snprintf replaced with sprintf + sprintf(temp, "%hu", port); protocol = temp; } else {