[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15135] trunk/blender/source/blender: added checks for zero length strings when checking for the last character
Campbell Barton
ideasman42 at gmail.com
Thu Jun 5 15:12:17 CEST 2008
Revision: 15135
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15135
Author: campbellbarton
Date: 2008-06-05 15:12:17 +0200 (Thu, 05 Jun 2008)
Log Message:
-----------
added checks for zero length strings when checking for the last character
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/intern/util.c
trunk/blender/source/blender/python/api2_2x/Sys.c
Modified: trunk/blender/source/blender/blenlib/intern/util.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/util.c 2008-06-05 13:02:17 UTC (rev 15134)
+++ trunk/blender/source/blender/blenlib/intern/util.c 2008-06-05 13:12:17 UTC (rev 15135)
@@ -1173,10 +1173,12 @@
strcpy(path, tmp);
}
- if (path[strlen(path)-1]=='/') {
- BLI_cleanup_dir(NULL, path);
- } else {
- BLI_cleanup_file(NULL, path);
+ if (path[0]!='\0') {
+ if ( path[strlen(path)-1]=='/') {
+ BLI_cleanup_dir(NULL, path);
+ } else {
+ BLI_cleanup_file(NULL, path);
+ }
}
#ifdef WIN32
Modified: trunk/blender/source/blender/python/api2_2x/Sys.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Sys.c 2008-06-05 13:02:17 UTC (rev 15134)
+++ trunk/blender/source/blender/python/api2_2x/Sys.c 2008-06-05 13:12:17 UTC (rev 15135)
@@ -411,7 +411,7 @@
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected string argument" );
last = strlen(path)-1;
- if ((path[last]=='/') || (path[last]=='\\')) {
+ if ((last >= 0) && ((path[last]=='/') || (path[last]=='\\'))) {
trailing_slash = 1;
}
BLI_strncpy(cleaned, path, FILE_MAXDIR + FILE_MAXFILE);
More information about the Bf-blender-cvs
mailing list