[vlc-commits] ncurses: fix NULL deref
Rémi Denis-Courmont
git at videolan.org
Wed Oct 21 18:45:24 CEST 2015
vlc/vlc-2.2 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Aug 21 20:07:49 2015 +0300| [412806b14a3dcc9c3652f7647df9296c86e78473] | committer: Jean-Baptiste Kempf
ncurses: fix NULL deref
in empty directory
(cherry picked from commit a3b0202259c36a225a472bad207599dcfe028c92)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=412806b14a3dcc9c3652f7647df9296c86e78473
---
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 7a4e175..291506a 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