[Mit-cadr-cvs] r403 - branches/ggilley/emulator/usim

ggilley at common-lisp.net ggilley at common-lisp.net
Sat Dec 8 22:37:39 UTC 2012


Author: ggilley
Date: Sat Dec  8 14:37:39 2012
New Revision: 403

Log:
fix a crash if treeroot is NULL

Modified:
   branches/ggilley/emulator/usim/Files.c

Modified: branches/ggilley/emulator/usim/Files.c
==============================================================================
--- branches/ggilley/emulator/usim/Files.c	Sat Dec  8 14:33:59 2012	(r402)
+++ branches/ggilley/emulator/usim/Files.c	Sat Dec  8 14:37:39 2012	(r403)
@@ -4160,13 +4160,13 @@
     } else if (*path == '/')
     {
 #if defined(OSX) || defined(linux)
-        size_t newlength = strlen(treeroot) + strlen(path);
-        
         if (treeroot == NULL || path[0] != '/' || tolower(path[1]) != 't' || tolower(path[2]) != 'r' ||
             tolower(path[3]) != 'e' || tolower(path[4]) != 'e' || (path[5] != '/' && path[5] != '\0'))
             wd = "";
         else
         {
+            size_t newlength = strlen(treeroot) + strlen(path);
+            
             wd = malloc(newlength);
             strcpy(wd, treeroot);
             path += 6;




More information about the mit-cadr-cvs mailing list