summaryrefslogtreecommitdiffstats
path: root/rasmgr/rasmgr_srv.cc
diff options
context:
space:
mode:
authorPeter Baumann <p.baumann@jacobs-university.de>2010-09-01 15:44:30 +0200
committerwww-data <www-data@ubuntu.localdomain>2010-12-19 23:43:41 +0100
commitdfc7584869a55b0dca46a41a8396f94cd3212612 (patch)
tree6c2d14e5bfd7c520b394bee39101e24e9358ec41 /rasmgr/rasmgr_srv.cc
parentd99d4f99a98436fc96d9d4e15f0e24c7a3ebdc9f (diff)
downloadrasdaman-upstream-dfc7584869a55b0dca46a41a8396f94cd3212612.tar.gz
rasdaman-upstream-dfc7584869a55b0dca46a41a8396f94cd3212612.tar.xz
rasdaman-upstream-dfc7584869a55b0dca46a41a8396f94cd3212612.zip
avoid buffer oflo in rasserver invocation, use ARG_MAX consistently (also in place of self-defined MAX_CMD_LEN)
Diffstat (limited to 'rasmgr/rasmgr_srv.cc')
-rw-r--r--rasmgr/rasmgr_srv.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/rasmgr/rasmgr_srv.cc b/rasmgr/rasmgr_srv.cc
index 91c593c..057a39d 100644
--- a/rasmgr/rasmgr_srv.cc
+++ b/rasmgr/rasmgr_srv.cc
@@ -407,7 +407,7 @@ int RasServer::startServer()
sTypeString= serverType==SERVERTYPE_FLAG_RNP ? "--rnp" : sTypeString;
const char *rasmgrHost = ptrServerHost->useLocalHost() ? "localhost" : config.getHostName();
- char command[MAX_CMD_LEN+1];
+ char command[ARG_MAX+1];
const char *SPRINTF_FORMAT = "%s %s %s --rsn %s %s --lport %ld --mgr %s --mgrport %ld --connect %s %s";
// check for buffer oflo
unsigned int commandLen =
@@ -418,9 +418,9 @@ int RasServer::startServer()
+ 4 // aka strlen(config.getListenPort())
+ strlen(ptrDatabaseHost->getConnectionString())
+ strlen(extraParam);
- if (commandLen > MAX_CMD_LEN)
+ if (commandLen > ARG_MAX)
{
- TALK( "RasServer::startServer(): fatal error: command line can host " << MAX_CMD_LEN << " bytes, but needs " << commandLen << "." );
+ TALK( "RasServer::startServer(): fatal error: command line can host " << ARG_MAX << " bytes, but needs " << commandLen << "." );
std::cout<<"Error: rasserver command line too long, cannot launch. Disappointedly aborting server start." <<std::endl;
return RASSERVER_CMDLINEOFLO;
}