ecere/com/String: Fixed bad memory reads in PathCat(Slash)
authorJerome St-Louis <jerome@ecere.com>
Tue, 5 Nov 2013 01:28:41 +0000 (20:28 -0500)
committerJerome St-Louis <jerome@ecere.com>
Tue, 5 Nov 2013 01:28:41 +0000 (20:28 -0500)
ecere/src/com/String.ec

index 5d0e4dc..da0b20a 100644 (file)
@@ -325,9 +325,9 @@ public char * PathCatSlash(char * string, char * addedPath)
                if(strLen > -1)
                {
                   // Go back one directory
-                  for(;(ch = fileName[strLen]) && strLen > -1 && (ch == '/' || ch == '\\'); strLen--);
-                  for(;(ch = fileName[strLen]) && strLen > -1 && (ch != '/' && ch != '\\' && ch != ':'); strLen--);
-                  for(;(ch = fileName[strLen]) && strLen > -1 && (ch == '/' || ch == '\\'); strLen--);
+                  for(;strLen > -1 && (ch = fileName[strLen]) && (ch == '/' || ch == '\\'); strLen--);
+                  for(;strLen > -1 && (ch = fileName[strLen]) && (ch != '/' && ch != '\\' && ch != ':'); strLen--);
+                  for(;strLen > -1 && (ch = fileName[strLen]) && (ch == '/' || ch == '\\'); strLen--);
 
                   if(isURL)
                   {
@@ -544,9 +544,9 @@ public char * PathCat(char * string, char * addedPath)
                   bool separator = false;
 
                   // Go back one directory
-                  for(;(ch = fileName[strLen]) && strLen > -1 && (ch == '/' || ch == '\\'); strLen--);
-                  for(;(ch = fileName[strLen]) && strLen > -1 && (ch != '/' && ch != '\\' && ch != ':'); strLen--);
-                  for(;(ch = fileName[strLen]) && strLen > -1 && (ch == '/' || ch == '\\'); strLen--) separator = true;
+                  for(;strLen > -1 && (ch = fileName[strLen]) && (ch == '/' || ch == '\\'); strLen--);
+                  for(;strLen > -1 && (ch = fileName[strLen]) && (ch != '/' && ch != '\\' && ch != ':'); strLen--);
+                  for(;strLen > -1 && (ch = fileName[strLen]) && (ch == '/' || ch == '\\'); strLen--) separator = true;
 
                   if(isURL)
                   {