[Bf-blender-cvs] [ad86d6e] master: Fix T46056: User Preferences-> install from File freezes Blender.

Bastien Montagne noreply at git.blender.org
Wed Sep 9 11:04:02 CEST 2015


Commit: ad86d6ebdca4e36cfd34e5bec5d5b69197a426c6
Author: Bastien Montagne
Date:   Wed Sep 9 11:02:32 2015 +0200
Branches: master
https://developer.blender.org/rBad86d6ebdca4e36cfd34e5bec5d5b69197a426c6

Fix T46056: User Preferences-> install from File freezes Blender.

Own stupid error in recent fix for buffer overflow in `BLI_testextensie_glob()`...
Also found & fixed another potential buffer overflow in this func.

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

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 656657a..4692af0 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -1614,13 +1614,12 @@ bool BLI_testextensie_glob(const char *str, const char *ext_fnmatch)
 
 		if ((ext_next = strchr(ext_step, ';'))) {
 			len_ext = ext_next - ext_step + 1;
+			BLI_strncpy(pattern, ext_step, (len_ext > sizeof(pattern)) ? sizeof(pattern) : len_ext);
 		}
 		else {
-			len_ext = sizeof(pattern);
+			len_ext = BLI_strncpy_rlen(pattern, ext_step, sizeof(pattern));
 		}
 
-		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