[Scummvm-cvs-logs] scummvm master -> 8b9d4348f8e590de5693f6dd2ea0df0f5a4e445a
digitall
dgturner at iee.org
Thu Nov 14 19:34:09 CET 2013
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8b9d4348f8 SDL: Fix bug where config file path could exceed maximum path length.
Commit: 8b9d4348f8e590de5693f6dd2ea0df0f5a4e445a
https://github.com/scummvm/scummvm/commit/8b9d4348f8e590de5693f6dd2ea0df0f5a4e445a
Author: D G Turner (digitall at scummvm.org)
Date: 2013-11-14T10:35:03-08:00
Commit Message:
SDL: Fix bug where config file path could exceed maximum path length.
The fix is the change in the MAXPATHLEN check, but have also migrated
this to Common::String to make the fix easier.
Thanks to klusark for pointing out this problem.
Changed paths:
backends/platform/sdl/posix/posix.cpp
diff --git a/backends/platform/sdl/posix/posix.cpp b/backends/platform/sdl/posix/posix.cpp
index 7a8b1e7..954f404 100644
--- a/backends/platform/sdl/posix/posix.cpp
+++ b/backends/platform/sdl/posix/posix.cpp
@@ -80,15 +80,16 @@ bool OSystem_POSIX::hasFeature(Feature f) {
}
Common::String OSystem_POSIX::getDefaultConfigFileName() {
- char configFile[MAXPATHLEN];
+ Common::String configFile;
// On POSIX type systems, by default we store the config file inside
// to the HOME directory of the user.
const char *home = getenv("HOME");
- if (home != NULL && strlen(home) < MAXPATHLEN)
- snprintf(configFile, MAXPATHLEN, "%s/%s", home, _baseConfigName.c_str());
- else
- strcpy(configFile, _baseConfigName.c_str());
+ if (home != NULL && (strlen(home) + 1 + _baseConfigName.size()) < MAXPATHLEN) {
+ configFile = Common::String::format("%s/%s", home, _baseConfigName.c_str());
+ } else {
+ configFile = _baseConfigName;
+ }
return configFile;
}
More information about the Scummvm-git-logs
mailing list