aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--libmenu/menu_filesel.c2
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);