[vlc-commits] bluray: don't crash when file is NULL
Rafaël Carré
git at videolan.org
Wed Dec 28 01:17:24 CET 2011
vlc | branch: master | Rafaël Carré <funman at videolan.org> | Sun Dec 25 20:03:54 2011 -0500| [811ce44ff5e7f3db515b59fafcb452e09d1a48e6] | committer: Jean-Baptiste Kempf
bluray: don't crash when file is NULL
e.g. vlc bluray://0
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=811ce44ff5e7f3db515b59fafcb452e09d1a48e6
---
modules/access/bluray.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index 983eade..7bfc3f0 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -94,7 +94,7 @@ static int blurayOpen( vlc_object_t *object )
char *pos_title;
int i_title = -1;
- char bd_path[PATH_MAX];
+ char bd_path[PATH_MAX] = { '\0' };
const char *error_msg = NULL;
if (strcmp(p_demux->psz_access, "bluray")) {
@@ -117,8 +117,10 @@ static int blurayOpen( vlc_object_t *object )
TAB_INIT( p_sys->i_title, p_sys->pp_title );
/* store current bd_path */
- strncpy(bd_path, p_demux->psz_file, sizeof(bd_path));
- bd_path[PATH_MAX - 1] = '\0';
+ if (p_demux->psz_file) {
+ strncpy(bd_path, p_demux->psz_file, sizeof(bd_path));
+ bd_path[PATH_MAX - 1] = '\0';
+ }
p_sys->bluray = bd_open(bd_path, NULL);
if (!p_sys->bluray) {
More information about the vlc-commits
mailing list