summaryrefslogtreecommitdiffstats
path: root/rasmgr
diff options
context:
space:
mode:
authorPeter Baumann <baumann@floridita.rasdaman>2009-07-30 18:59:52 +0200
committerPeter Baumann <baumann@rasdaman.org>2009-07-30 18:33:40 +0200
commitd8154144b1cbf25dd7e41f6e375426554fca055a (patch)
treedbc15af2f29bccb4db78e8d89d5ad32cbff8d5bc /rasmgr
parentf5bac542b5dacb37a85324d020a17334e2b602a4 (diff)
downloadrasdaman-upstream-d8154144b1cbf25dd7e41f6e375426554fca055a.tar.gz
rasdaman-upstream-d8154144b1cbf25dd7e41f6e375426554fca055a.tar.xz
rasdaman-upstream-d8154144b1cbf25dd7e41f6e375426554fca055a.zip
PB: use CONFDIR for config file access; make sure there is no path buffer oflo
Diffstat (limited to 'rasmgr')
-rw-r--r--rasmgr/rasmgr_config.cc16
-rw-r--r--rasmgr/rasmgr_config.hh5
2 files changed, 12 insertions, 9 deletions
diff --git a/rasmgr/rasmgr_config.cc b/rasmgr/rasmgr_config.cc
index e0e1f4c..6e317a7 100644
--- a/rasmgr/rasmgr_config.cc
+++ b/rasmgr/rasmgr_config.cc
@@ -94,18 +94,20 @@ Configuration::Configuration():
configFileName[0]=0;
slave = false;
-
- char *rasHome= CONFDIR;
- if(rasHome!=0)
- sprintf(configFileName,"%s/",rasHome);
-
- strcat( configFileName, RASMGR_CONF_FILE );
+
+ if (sizeof(configFileName) < strlen(CONFDIR) + strlen(RASMGR_CONF_FILE) + 2)
+ {
+ std::cout << "Error: configuration path length exceeds system limits: '" << CONFDIR << "/" << RASMGR_CONF_FILE << "'" << endl;
+ LEAVE( "Configuration::Configuration: leave." );
+ return;
+ }
+ sprintf( configFileName, "%s/%s", CONFDIR, RASMGR_CONF_FILE );
altConfigFileName[0] = '\0';
testModus = false;
debugSupport = false;
rtHlTest = true; // by default RasMgr tests at runtime if it's the only one
- allowMultiWT = false; // rasmgr doesn't allow multiple write transactions for a db, but for internal use we can try it
+ allowMultiWT = false; // rasmgr doesn't allow multiple write transactions for a db
LEAVE( "Configuration::Configuration: leave." );
}
diff --git a/rasmgr/rasmgr_config.hh b/rasmgr/rasmgr_config.hh
index e8e7288..7ed1a99 100644
--- a/rasmgr/rasmgr_config.hh
+++ b/rasmgr/rasmgr_config.hh
@@ -39,6 +39,7 @@ rasdaman GmbH.
#include <iostream>
#include <string>
#include <sys/time.h>
+#include <linux/limits.h> // PATH_MAX
#include "commline/cmlparser.hh"
@@ -85,9 +86,9 @@ class Configuration
char publicHostName[HOSTNAME_SIZE]; // usually ==hostName, but you might want to publish IP address or hostname.domainname instead
int listenPort;
// name of configuration file
- char configFileName[HOSTNAME_SIZE];
+ char configFileName[PATH_MAX];
// name of alternate configuration file for rescue save, generated by saveAltConfigFile()
- char altConfigFileName[HOSTNAME_SIZE];
+ char altConfigFileName[PATH_MAX];
// if slave
char masterName[HOSTNAME_SIZE];