mirror of
https://github.com/mpv-player/mpv.git
synced 2026-05-07 20:02:49 +00:00
stream_mpv: restrict only to network links
This commit is contained in:
+1
-1
@@ -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
@@ -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},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user