8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 10:43:03 +01:00

Port numbers are limited to 16 bit.

This commit is contained in:
eku 2004-01-13 13:38:36 +00:00
parent 61de58f8ae
commit 14b3de174e
3 changed files with 8 additions and 7 deletions

View File

@ -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()

View File

@ -245,7 +245,7 @@ public:
/*
Service port for INET
*/
static int getRemoteServicePort();
static unsigned short getRemoteServicePort();
/*
Pipe name for WNET

View File

@ -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 {