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
35573557 {
35583558 switch (action) {
35593559 case M_PROPERTY_GET:
3560− *(char ***)arg = stream_get_proto_list();
3560+ *(char ***)arg = stream_get_proto_list(false);
35613561 return M_PROPERTY_OK;
35623562 case M_PROPERTY_GET_TYPE:
35633563 *(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
882882 return res;
883883 }
884884
885−char **stream_get_proto_list(void)
885+char **stream_get_proto_list(bool safe_only)
886886 {
887887 char **list = NULL;
888888 int num = 0;
889889 for (int i = 0; i < MP_ARRAY_SIZE(stream_list); i++) {
890890 const stream_info_t *stream_info = stream_list[i];
891+ if (safe_only && (stream_info->stream_origin & STREAM_ORIGIN_UNSAFE))
892+ continue;
891893
892894 char **get_protocols = stream_info->get_protocols ? stream_info->get_protocols() : NULL;
893895 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
910912 int count = 0;
911913
912914 mp_info(log, "Protocols:\n\n");
913− char **list = stream_get_proto_list();
915+ char **list = stream_get_proto_list(false);
914916 for (int i = 0; list[i]; i++) {
915917 mp_info(log, " %s://\n", list[i]);
916918 count++;
stream/stream.h+1−1
@@ -282,7 +282,7 @@ void mp_setup_av_network_options(struct AVDictionary **dict, · 281 unmodified lines
282282 struct mp_log *log);
283283
284284 void stream_print_proto_list(struct mp_log *log);
285−char **stream_get_proto_list(void);
285+char **stream_get_proto_list(bool safe_only);
286286 bool stream_has_proto(const char *proto);
287287
288288 #endif /* MPLAYER_STREAM_H */
stream/stream_edl.c+1−0
@@ -14,4 +14,5 @@ const stream_info_t stream_info_edl = { · 13 unmodified lines
1414 .name = "edl",
1515 .open = s_open,
1616 .protocols = (const char*const[]){"edl", NULL},
17+ .stream_origin = STREAM_ORIGIN_UNSAFE,
1718 };
stream/stream_mf.c+1−1
@@ -37,5 +37,5 @@ const stream_info_t stream_info_mf = { · 36 unmodified lines
3737 .name = "mf",
3838 .open = mf_stream_open,
3939 .protocols = (const char*const[]){ "mf", NULL },
40− .stream_origin = STREAM_ORIGIN_FS,
40+ .stream_origin = STREAM_ORIGIN_FS | STREAM_ORIGIN_UNSAFE,
4141 };

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