[Bf-blender-cvs] [4f61de6] master: Fix T45884: Crash copying keyframes

Campbell Barton noreply at git.blender.org
Mon Aug 24 01:36:06 CEST 2015


Commit: 4f61de65883959f62e94bd5f4065cd04f0b9595f
Author: Campbell Barton
Date:   Mon Aug 24 09:23:24 2015 +1000
Branches: master
https://developer.blender.org/rB4f61de65883959f62e94bd5f4065cd04f0b9595f

Fix T45884: Crash copying keyframes

BLI_str_quoted_substrN could crash if the prefix wasn't found

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

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

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

diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index 6d75f7c..6cc00fc 100644
--- a/source/blender/blenlib/intern/string.c
+++ b/source/blender/blenlib/intern/string.c
@@ -379,12 +379,13 @@ escape_finish:
  */
 char *BLI_str_quoted_substrN(const char *__restrict str, const char *__restrict prefix)
 {
-	size_t prefixLen = strlen(prefix);
 	const char *startMatch, *endMatch;
-	
+
 	/* get the starting point (i.e. where prefix starts, and add prefixLen+1 to it to get be after the first " */
-	startMatch = strstr(str, prefix) + prefixLen + 1;
+	startMatch = strstr(str, prefix);
 	if (startMatch) {
+		const size_t prefixLen = strlen(prefix);
+		startMatch += prefixLen + 1;
 		/* get the end point (i.e. where the next occurance of " is after the starting point) */
 
 		endMatch = startMatch;




More information about the Bf-blender-cvs mailing list