Author: bgbnbigben
Date: 2011-02-22 13:42:17 -0800 (Tue, 22 Feb 2011)
New Revision: 8464
Log:
Fixed a case in the FileChooser that would cause strlen() to be evaulated with 
a NULL pointer. #2571 closed.


Modified:
   trunk/src/FileChooser2.cxx

Modified: trunk/src/FileChooser2.cxx
===================================================================
--- trunk/src/FileChooser2.cxx  2011-02-22 17:50:25 UTC (rev 8463)
+++ trunk/src/FileChooser2.cxx  2011-02-22 21:42:17 UTC (rev 8464)
@@ -996,9 +996,11 @@
     int length = utf8frommb(NULL, 0, cfilename, strlen(cfilename));
     filename = (char*)malloc(sizeof(char)*length+11);
     utf8frommb(filename, length+1, cfilename, length+1);
-  } else {
+  } else if(cfilename != NULL) {
     filename = (char*)malloc(sizeof(char)*strlen(cfilename)+11);
     strcpy(filename, cfilename);
+  } else {
+    filename = NULL;
   }
   if (filename == NULL || fltk::filename_isdir(filename)) image = NULL;
   else {

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to