diff options
author | ben <ben@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2008-06-05 19:46:16 +0000 |
---|---|---|
committer | ben <ben@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2008-06-05 19:46:16 +0000 |
commit | 8d4cdcc158ab76261022ee59ba14f6a0212e7c69 (patch) | |
tree | 037f9063eab579bef4f3d8f26e2d28930e11d477 | |
parent | ae29cb22de411d54407d8c1adde53adee5bbc51d (diff) |
Ensure 'path' string is 0 terminated.
Patch by Guillaume Lecerf <foxcore at gmail com>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26992 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | libmenu/menu_filesel.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libmenu/menu_filesel.c b/libmenu/menu_filesel.c index 2dde57daba..135d57224a 100644 --- a/libmenu/menu_filesel.c +++ b/libmenu/menu_filesel.c @@ -410,10 +410,10 @@ static int open_fs(menu_t* menu, char* args) { 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); |