[MPlayer-cvslog] r26992 - trunk/libmenu/menu_filesel.c

ben subversion at mplayerhq.hu
Thu Jun 5 21:46:17 CEST 2008


Author: ben
Date: Thu Jun  5 21:46:16 2008
New Revision: 26992

Log:
Ensure 'path' string is 0 terminated.
Patch by Guillaume Lecerf <foxcore at gmail com>



Modified:
   trunk/libmenu/menu_filesel.c

Modified: trunk/libmenu/menu_filesel.c
==============================================================================
--- trunk/libmenu/menu_filesel.c	(original)
+++ trunk/libmenu/menu_filesel.c	Thu Jun  5 21:46:16 2008
@@ -410,10 +410,10 @@ static int open_fs(menu_t* menu, char* a
       if (path_fp >= 0) {
         if (!fstat (path_fp, &st) && (st.st_size > 0)) {
           path = malloc(st.st_size+1);
+          path[st.st_size] = '\0';
           if ((read(path_fp, path, st.st_size) == st.st_size) && path[0] == '/'
               && !stat(path, &st) && S_ISDIR(st.st_mode)){
             freepath = path;
-            path[st.st_size] = '\0';
           }
           else {
             free(path);



More information about the MPlayer-cvslog mailing list