diff options
Diffstat (limited to 'rasmgr')
-rw-r--r-- | rasmgr/rasmgr_config.cc | 16 | ||||
-rw-r--r-- | rasmgr/rasmgr_config.hh | 5 |
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]; |