Fix incorrect strncpy use
authorCampbell Barton <ideasman42@gmail.com>
Wed, 10 Oct 2018 22:36:43 +0000 (09:36 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 10 Oct 2018 22:36:43 +0000 (09:36 +1100)
Didn't ensure null terminated.

source/blender/blenlib/intern/path_util.c

index 10ca0fa6cbf95e13cbd79c75874919e8f6326b24..84c932db1c74e05c94fe4a03a4c1ff1ba4d7092c 100644 (file)
@@ -1160,12 +1160,12 @@ bool BLI_path_program_search(
                do {
                        temp = strchr(path, separator);
                        if (temp) {
-                               strncpy(filename, path, temp - path);
+                               memcpy(filename, path, temp - path);
                                filename[temp - path] = 0;
                                path = temp + 1;
                        }
                        else {
-                               strncpy(filename, path, sizeof(filename));
+                               BLI_strncpy(filename, path, sizeof(filename));
                        }
 
                        BLI_path_append(filename, maxlen, name);