From 45c60777562c65922d87f2216fc0851536c95c24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Fri, 7 Mar 2025 11:14:45 +0100 Subject: [PATCH] stream_mpv: restrict only to network links --- DOCS/man/mpv.rst | 2 +- stream/stream_mpv.c | 16 +--------------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/DOCS/man/mpv.rst b/DOCS/man/mpv.rst index 6fd8ab74fe..03f5f8ff0b 100644 --- a/DOCS/man/mpv.rst +++ b/DOCS/man/mpv.rst @@ -1284,7 +1284,7 @@ PROTOCOLS mpv protocol. This is used for starting mpv from URL handler. The protocol is stripped and the rest is passed to the player as a normal open argument. - Only safe protocols are allowed to be opened this way. + Only safe network protocols are allowed to be opened this way. ``http://...``, ``https://``, ... diff --git a/stream/stream_mpv.c b/stream/stream_mpv.c index dd0e6e25c0..63c0d65c3d 100644 --- a/stream/stream_mpv.c +++ b/stream/stream_mpv.c @@ -22,21 +22,6 @@ static int open_mpv(stream_t *st) { - bstr proto = mp_split_proto(bstr0(st->path), NULL); - if (proto.len) { - if (!bstrcasecmp0(proto, "mpv")) { - MP_ERR(st, "Nested mpv:// is not allowed.\n"); - return STREAM_NO_MATCH; - } - char **safe_protocols = stream_get_proto_list(true); - bool safe = str_in_list(proto, safe_protocols); - talloc_free(safe_protocols); - if (!safe) { - MP_ERR(st, "Unsafe protocol '%.*s' opened with mpv://.\n", BSTR_P(proto)); - return STREAM_NO_MATCH; - } - } - st->demuxer = "mpv"; return STREAM_OK; } @@ -44,5 +29,6 @@ static int open_mpv(stream_t *st) const stream_info_t stream_info_mpv = { .name = "mpv", .open = open_mpv, + .stream_origin = STREAM_ORIGIN_NET, .protocols = (const char*const[]){"mpv", NULL}, };