stream_mpv: restrict only to network links

This commit is contained in:
Kacper Michajłow
2025-03-07 11:14:45 +01:00
parent 839aa31b7e
commit 45c6077756
2 changed files with 2 additions and 16 deletions
+1 -1
View File
@@ -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://``, ...
+1 -15
View File
@@ -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},
};