stream/stream: mark mf:// and edl:// as unsafe protocols

This commit is contained in:
Kacper Michajłow committed 2025-03-07 00:15:23 +01:00
1 parent 27f39811fa
commit 9bc3aee6fb
5 files changed
+8 -5

No files matched your search

+1 -1
View File
@@ -3557,7 +3557,7 @@ static int mp_property_protocols(void *ctx, struct m_property *prop,
{
switch (action) {
case M_PROPERTY_GET:
*(char ***)arg = stream_get_proto_list();
*(char ***)arg = stream_get_proto_list(false);
return M_PROPERTY_OK;
case M_PROPERTY_GET_TYPE:
*(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_STRING_LIST};
+4 -2
View File
@@ -882,12 +882,14 @@ struct bstr stream_read_file2(const char *filename, void *talloc_ctx,
return res;
}
char **stream_get_proto_list(void)
char **stream_get_proto_list(bool safe_only)
{
char **list = NULL;
int num = 0;
for (int i = 0; i < MP_ARRAY_SIZE(stream_list); i++) {
const stream_info_t *stream_info = stream_list[i];
if (safe_only && (stream_info->stream_origin & STREAM_ORIGIN_UNSAFE))
continue;
char **get_protocols = stream_info->get_protocols ? stream_info->get_protocols() : NULL;
char **protocols = get_protocols ? get_protocols : (char **)stream_info->protocols;
@@ -910,7 +912,7 @@ void stream_print_proto_list(struct mp_log *log)
int count = 0;
mp_info(log, "Protocols:\n\n");
char **list = stream_get_proto_list();
char **list = stream_get_proto_list(false);
for (int i = 0; list[i]; i++) {
mp_info(log, " %s://\n", list[i]);
count++;
+1 -1
View File
@@ -282,7 +282,7 @@ void mp_setup_av_network_options(struct AVDictionary **dict,
struct mp_log *log);
void stream_print_proto_list(struct mp_log *log);
char **stream_get_proto_list(void);
char **stream_get_proto_list(bool safe_only);
bool stream_has_proto(const char *proto);
#endif /* MPLAYER_STREAM_H */
+1
View File
@@ -14,4 +14,5 @@ const stream_info_t stream_info_edl = {
.name = "edl",
.open = s_open,
.protocols = (const char*const[]){"edl", NULL},
.stream_origin = STREAM_ORIGIN_UNSAFE,
};
+1 -1
View File
@@ -37,5 +37,5 @@ const stream_info_t stream_info_mf = {
.name = "mf",
.open = mf_stream_open,
.protocols = (const char*const[]){ "mf", NULL },
.stream_origin = STREAM_ORIGIN_FS,
.stream_origin = STREAM_ORIGIN_FS | STREAM_ORIGIN_UNSAFE,
};