diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/config-manager.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/common/config-manager.cpp b/common/config-manager.cpp index 08edb25240..995d9d601a 100644 --- a/common/config-manager.cpp +++ b/common/config-manager.cpp @@ -92,8 +92,9 @@ ConfigManager::ConfigManager() { void ConfigManager::loadDefaultConfigFile() { char configFile[MAXPATHLEN]; #if defined(UNIX) - if (getenv("HOME") != NULL) - sprintf(configFile,"%s/%s", getenv("HOME"), DEFAULT_CONFIG_FILE); + const char *home = getenv("HOME"); + if (home != NULL && strlen(home) < MAXPATHLEN) + snprintf(configFile, MAXPATHLEN, "%s/%s", home, DEFAULT_CONFIG_FILE); else strcpy(configFile, DEFAULT_CONFIG_FILE); #else |