[Bf-blender-cvs] [b618c185cb7] master: Fix incorrect strncpy use

Campbell Barton noreply at git.blender.org
Thu Oct 11 00:37:32 CEST 2018


Commit: b618c185cb7c5930980e459c84b8818a0fba1f1d
Author: Campbell Barton
Date:   Thu Oct 11 09:36:43 2018 +1100
Branches: master
https://developer.blender.org/rBb618c185cb7c5930980e459c84b8818a0fba1f1d

Fix incorrect strncpy use

Didn't ensure null terminated.

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

M	source/blender/blenlib/intern/path_util.c

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

diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index 10ca0fa6cbf..84c932db1c7 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -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);



More information about the Bf-blender-cvs mailing list