[Bf-blender-cvs] [e1eaf9e2b4e] blender-v2.91-release: Fix T81925: incorrectly skipped string copy in test_env_path

Robert Guetzkow noreply at git.blender.org
Thu Oct 22 00:55:36 CEST 2020


Commit: e1eaf9e2b4ef85f0f899d1429200fe51c5625c2a
Author: Robert Guetzkow
Date:   Thu Oct 22 09:51:51 2020 +1100
Branches: blender-v2.91-release
https://developer.blender.org/rBe1eaf9e2b4ef85f0f899d1429200fe51c5625c2a

Fix T81925: incorrectly skipped string copy in test_env_path

Regression in 6f3a9031f7b93e7c687edde646beed9f02d920d4

Ref D9306

===================================================================

M	source/blender/blenkernel/intern/appdir.c

===================================================================

diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c
index 44fc608530b..00c62340e16 100644
--- a/source/blender/blenkernel/intern/appdir.c
+++ b/source/blender/blenkernel/intern/appdir.c
@@ -254,8 +254,12 @@ static bool test_path(char *targetpath,
 }
 
 /**
- * Puts the value of the specified environment variable into *path if it exists
- * and points at a directory. Returns true if this was done.
+ * Puts the value of the specified environment variable into \a path if it exists.
+ *
+ * \param check_is_dir: When true, checks if it points at a directory.
+ *
+ * \returns true when the value of the environment variable is stored
+ * at the address \a path points to.
  */
 static bool test_env_path(char *path, const char *envvar, const bool check_is_dir)
 {
@@ -266,13 +270,14 @@ static bool test_env_path(char *path, const char *envvar, const bool check_is_di
     return false;
   }
 
+  BLI_strncpy(path, env_path, FILE_MAX);
+
   if (check_is_dir == false) {
     CLOG_INFO(&LOG, 3, "using env '%s' without test: '%s'", envvar, env_path);
     return true;
   }
 
   if (BLI_is_dir(env_path)) {
-    BLI_strncpy(path, env_path, FILE_MAX);
     CLOG_INFO(&LOG, 3, "env '%s' found: %s", envvar, env_path);
     return true;
   }



More information about the Bf-blender-cvs mailing list