[Bf-blender-cvs] [9de2096] master: Fix beautiful textbook case of string overflow in `BLI_testextensie_glob`...

Bastien Montagne noreply at git.blender.org
Mon Sep 7 19:26:01 CEST 2015


Commit: 9de20963cd6eddf1ef1e3d3ec5ee65d537af4b04
Author: Bastien Montagne
Date:   Mon Sep 7 19:21:12 2015 +0200
Branches: master
https://developer.blender.org/rB9de20963cd6eddf1ef1e3d3ec5ee65d537af4b04

Fix beautiful textbook case of string overflow in `BLI_testextensie_glob`...

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

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 3a73d4c..656657a 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -1610,16 +1610,16 @@ bool BLI_testextensie_glob(const char *str, const char *ext_fnmatch)
 
 	while (ext_step[0]) {
 		const char *ext_next;
-		int len_ext;
+		size_t len_ext;
 
 		if ((ext_next = strchr(ext_step, ';'))) {
-			len_ext = (int)(ext_next - ext_step) + 1;
+			len_ext = ext_next - ext_step + 1;
 		}
 		else {
 			len_ext = sizeof(pattern);
 		}
 
-		BLI_strncpy(pattern, ext_step, len_ext);
+		len_ext = BLI_strncpy_rlen(pattern, ext_step, len_ext);
 
 		if (fnmatch(pattern, str, FNM_CASEFOLD) == 0) {
 			return true;




More information about the Bf-blender-cvs mailing list