diff options
author | wm4 <wm4@nowhere> | 2015-05-09 15:37:05 +0200 |
---|---|---|
committer | Diogo Franco (Kovensky) <diogomfranco@gmail.com> | 2015-05-15 10:27:30 +0900 |
commit | 9ed399f27c42fb6ab57ec59e6db348a7db635653 (patch) | |
tree | 48131aeeadfdbfcf853b09cef08d64ceb7f8a0f4 | |
parent | 0d9275b931f997746f90c754de0b3376577fa7e1 (diff) | |
download | mpv-9ed399f27c42fb6ab57ec59e6db348a7db635653.tar.bz2 mpv-9ed399f27c42fb6ab57ec59e6db348a7db635653.tar.xz |
player: avoid undefined behavior when resumign DVD/BD playback
These device options can be NULL, and NULL can't be passed for %s.
(cherry picked from commit 34ee78f2cba0510cc37162e89cbdc9d4a9514f92)
-rw-r--r-- | player/configfiles.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/player/configfiles.c b/player/configfiles.c index 52cd837ab7..a48223d8e7 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, bstr0(cwd), bstr0(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)); |