From 34ee78f2cba0510cc37162e89cbdc9d4a9514f92 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 9 May 2015 15:37:05 +0200 Subject: [PATCH] player: avoid undefined behavior when resumign DVD/BD playback These device options can be NULL, and NULL can't be passed for %s. --- player/configfiles.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/player/configfiles.c b/player/configfiles.c index 984a0fd02e..6806938a1a 100644 --- a/player/configfiles.c +++ b/player/configfiles.c @@ -184,10 +184,10 @@ static char *mp_get_playback_resume_config_filename(struct mpv_global *global, realpath = mp_path_join(tmp, cwd, fname); } } - if (bstr_startswith0(bfname, "dvd://")) + if (bstr_startswith0(bfname, "dvd://") && opts->dvd_device) realpath = talloc_asprintf(tmp, "%s - %s", realpath, opts->dvd_device); - if (bstr_startswith0(bfname, "br://") || bstr_startswith0(bfname, "bd://") || - bstr_startswith0(bfname, "bluray://")) + if ((bstr_startswith0(bfname, "br://") || bstr_startswith0(bfname, "bd://") || + bstr_startswith0(bfname, "bluray://")) && opts->bluray_device) realpath = talloc_asprintf(tmp, "%s - %s", realpath, opts->bluray_device); uint8_t md5[16]; av_md5_sum(md5, realpath, strlen(realpath));