[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42808] trunk/blender/source/blender/ blenlib/intern/path_util.c: patch [#29667] Fix for potential memory corruption in path_util.c

Campbell Barton ideasman42 at gmail.com
Wed Dec 21 21:56:49 CET 2011


Revision: 42808
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42808
Author:   campbellbarton
Date:     2011-12-21 20:56:49 +0000 (Wed, 21 Dec 2011)
Log Message:
-----------
patch [#29667] Fix for potential memory corruption in path_util.c
from Andrew Wiggin (ender79)

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/intern/path_util.c

Modified: trunk/blender/source/blender/blenlib/intern/path_util.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/path_util.c	2011-12-21 20:51:55 UTC (rev 42807)
+++ trunk/blender/source/blender/blenlib/intern/path_util.c	2011-12-21 20:56:49 UTC (rev 42808)
@@ -317,7 +317,7 @@
 
 void BLI_cleanup_path(const char *relabase, char *dir)
 {
-	short a;
+	ptrdiff_t a;
 	char *start, *eind;
 	if (relabase) {
 		BLI_path_abs(dir, relabase);
@@ -1416,7 +1416,7 @@
 {
 	size_t path_len= strlen(path);
 	size_t ext_len= strlen(ext);
-	size_t a;
+	ssize_t a;
 
 	for(a= path_len - 1; a >= 0; a--) {
 		if (ELEM3(path[a], '.', '/', '\\')) {
@@ -1424,7 +1424,7 @@
 		}
 	}
 
-	if (path[a] != '.') {
+	if ((a < 0) || (path[a] != '.')) {
 		a= path_len;
 	}
 
@@ -1440,7 +1440,7 @@
 {
 	size_t path_len= strlen(path);
 	size_t ext_len= strlen(ext);
-	size_t a;
+	ssize_t a;
 
 	/* first check the extension is alread there */
 	if (    (ext_len <= path_len) &&




More information about the Bf-blender-cvs mailing list