Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-10-23 09:56:55 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-10-23 09:56:55 +0400
commit0664868aec515111fe419a7ec73c19441cd1e19d (patch)
treef86bcb40196ccacece9e12f71e2780cebb8abb9e /source/blender/blenlib
parente58eb5db6f7340494ceeabafe9e7d04377122d70 (diff)
BLI_make_file_string wasn't guaranteed to initialize the resulting path, some parts of the code accounted for this but most not, always initialize the string to "".
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/intern/path_util.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index d9176c5f162..d28c1e29820 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -1257,9 +1257,18 @@ void BLI_make_file_string(const char *relabase, char *string, const char *dir,
{
int sl;
- if (!string || !dir || !file) return; /* We don't want any NULLs */
-
- string[0]= 0; /* ton */
+ if (string) {
+ /* ensure this is always set even if dir/file are NULL */
+ string[0]= '\0';
+
+ if (ELEM(NULL, dir, file)) {
+ return; /* We don't want any NULLs */
+ }
+ }
+ else {
+ return; /* string is NULL, probably shouldnt happen but return anyway */
+ }
+
/* we first push all slashes into unix mode, just to make sure we don't get
any mess with slashes later on. -jesterKing */