[vlc-commits] ncurses: fix NULL deref
Rémi Denis-Courmont
git at videolan.org
Fri Aug 21 19:14:26 CEST 2015
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Aug 21 20:07:49 2015 +0300| [a3b0202259c36a225a472bad207599dcfe028c92] | committer: Rémi Denis-Courmont
ncurses: fix NULL deref
in empty directory
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a3b0202259c36a225a472bad207599dcfe028c92
---
modules/gui/ncurses.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/modules/gui/ncurses.c b/modules/gui/ncurses.c
index 2a7a06f..14c6987 100644
--- a/modules/gui/ncurses.c
+++ b/modules/gui/ncurses.c
@@ -303,10 +303,11 @@ static void ReadDir(intf_thread_t *intf)
continue;
}
- qsort(sys->dir_entries, sys->n_dir_entries,
- sizeof(struct dir_entry_t*), &comdir_entries);
-
closedir(current_dir);
+
+ if (sys->n_dir_entries > 0)
+ qsort(sys->dir_entries, sys->n_dir_entries,
+ sizeof(struct dir_entry_t*), &comdir_entries);
}
/*****************************************************************************
More information about the vlc-commits
mailing list