| 870 | } |
| 871 | |
| 872 | int ff_format_check_set_url(AVFormatContext *s, const char *url) |
| 873 | { |
| 874 | URLComponents uc; |
| 875 | av_assert0(url); |
| 876 | char proto[64]; |
| 877 | |
| 878 | int ret = ff_url_decompose(&uc, url, NULL); |
| 879 | if (ret < 0) |
| 880 | return ret; |
| 881 | av_strlcpy(proto, uc.scheme, FFMIN(sizeof(proto), uc.url_component_end_scheme - uc.scheme)); |
| 882 | |
| 883 | if (s->protocol_whitelist && av_match_list(proto, s->protocol_whitelist, ',') <= 0) { |
| 884 | av_log(s, AV_LOG_ERROR, "Protocol '%s' not on whitelist '%s'!\n", proto, s->protocol_whitelist); |
| 885 | return AVERROR(EINVAL); |
| 886 | } |
| 887 | |
| 888 | if (s->protocol_blacklist && av_match_list(proto, s->protocol_blacklist, ',') > 0) { |
| 889 | av_log(s, AV_LOG_ERROR, "Protocol '%s' on blacklist '%s'!\n", proto, s->protocol_blacklist); |
| 890 | return AVERROR(EINVAL); |
| 891 | } |
| 892 | |
| 893 | char *urldup = av_strdup(url); |
| 894 | if (!urldup) |
| 895 | return AVERROR(ENOMEM); |
| 896 | |
| 897 | av_freep(&s->url); |
| 898 | s->url = urldup; |
| 899 | return 0; |
| 900 | } |
| 901 | |
| 902 | |
| 903 | int ff_format_io_close(AVFormatContext *s, AVIOContext **pb) |
no test coverage detected