History

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

Kacper Michajłow committed 1 year ago

Commit 9bc3aee1 parent 27f39815 files · +8 −5Browse files

Unified · Split

5 files
  1. player/command.c +1 −1
  2. stream/stream.c +4 −2
  3. stream/stream.h +1 −1
  4. stream/stream_edl.c +1 −0
  5. stream/stream_mf.c +1 −1
player/command.c+1−1
@@ -3557,7 +3557,7 @@ static int mp_property_protocols(void *ctx, struct m_property *prop, · 3556 unmodified lines
3557{3557{
3558 switch (action) {3558 switch (action) {
3559 case M_PROPERTY_GET:3559 case M_PROPERTY_GET:
3560 *(char ***)arg = stream_get_proto_list();3560 *(char ***)arg = stream_get_proto_list(false);
3561 return M_PROPERTY_OK;3561 return M_PROPERTY_OK;
3562 case M_PROPERTY_GET_TYPE:3562 case M_PROPERTY_GET_TYPE:
3563 *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_STRING_LIST};3563 *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_STRING_LIST};
stream/stream.c+4−2
@@ -882,12 +882,14 @@ struct bstr stream_read_file2(const char *filename, void *talloc_ctx, · 881 unmodified lines
882 return res;882 return res;
883}883}
884 884
885char **stream_get_proto_list(void)885char **stream_get_proto_list(bool safe_only)
886{886{
887 char **list = NULL;887 char **list = NULL;
888 int num = 0;888 int num = 0;
889 for (int i = 0; i < MP_ARRAY_SIZE(stream_list); i++) {889 for (int i = 0; i < MP_ARRAY_SIZE(stream_list); i++) {
890 const stream_info_t *stream_info = stream_list[i];890 const stream_info_t *stream_info = stream_list[i];
891 if (safe_only && (stream_info->stream_origin & STREAM_ORIGIN_UNSAFE))
892 continue;
891 893
892 char **get_protocols = stream_info->get_protocols ? stream_info->get_protocols() : NULL;894 char **get_protocols = stream_info->get_protocols ? stream_info->get_protocols() : NULL;
893 char **protocols = get_protocols ? get_protocols : (char **)stream_info->protocols;895 char **protocols = get_protocols ? get_protocols : (char **)stream_info->protocols;
@@ -910,7 +912,7 @@ void stream_print_proto_list(struct mp_log *log) · 16 unmodified lines
910 int count = 0;912 int count = 0;
911 913
912 mp_info(log, "Protocols:\n\n");914 mp_info(log, "Protocols:\n\n");
913 char **list = stream_get_proto_list();915 char **list = stream_get_proto_list(false);
914 for (int i = 0; list[i]; i++) {916 for (int i = 0; list[i]; i++) {
915 mp_info(log, " %s://\n", list[i]);917 mp_info(log, " %s://\n", list[i]);
916 count++;918 count++;
stream/stream.h+1−1
@@ -282,7 +282,7 @@ void mp_setup_av_network_options(struct AVDictionary **dict, · 281 unmodified lines
282 struct mp_log *log);282 struct mp_log *log);
283 283
284void stream_print_proto_list(struct mp_log *log);284void stream_print_proto_list(struct mp_log *log);
285char **stream_get_proto_list(void);285char **stream_get_proto_list(bool safe_only);
286bool stream_has_proto(const char *proto);286bool stream_has_proto(const char *proto);
287 287
288#endif /* MPLAYER_STREAM_H */288#endif /* MPLAYER_STREAM_H */
stream/stream_edl.c+1−0
@@ -14,4 +14,5 @@ const stream_info_t stream_info_edl = { · 13 unmodified lines
14 .name = "edl",14 .name = "edl",
15 .open = s_open,15 .open = s_open,
16 .protocols = (const char*const[]){"edl", NULL},16 .protocols = (const char*const[]){"edl", NULL},
17 .stream_origin = STREAM_ORIGIN_UNSAFE,
17};18};
stream/stream_mf.c+1−1
@@ -37,5 +37,5 @@ const stream_info_t stream_info_mf = { · 36 unmodified lines
37 .name = "mf",37 .name = "mf",
38 .open = mf_stream_open,38 .open = mf_stream_open,
39 .protocols = (const char*const[]){ "mf", NULL },39 .protocols = (const char*const[]){ "mf", NULL },
40 .stream_origin = STREAM_ORIGIN_FS,40 .stream_origin = STREAM_ORIGIN_FS | STREAM_ORIGIN_UNSAFE,
41};41};

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t