diff options
author | Anton Khirnov <anton@khirnov.net> | 2016-02-19 11:17:22 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2016-02-22 11:35:57 +0100 |
commit | 832a202c47a246ed15e3edc6b05dfcfa7d82c4b2 (patch) | |
tree | 6588a47d57c9301ae3ac1d97aae81c1a1ec205f5 /libavformat/avio.c | |
parent | 7d61dc95d741ca134d59b1f34c4e10c4c4e36f56 (diff) | |
download | ffmpeg-832a202c47a246ed15e3edc6b05dfcfa7d82c4b2.tar.gz |
protocols: make the list of protocols static
Disallow other code to touch it directly, now it's only accessible
through a blacklisting/whitelisting function.
Diffstat (limited to 'libavformat/avio.c')
-rw-r--r-- | libavformat/avio.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/libavformat/avio.c b/libavformat/avio.c index b4e57e943a..a9a399af93 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -138,6 +138,7 @@ int ffurl_connect(URLContext *uc, AVDictionary **options) int ffurl_alloc(URLContext **puc, const char *filename, int flags, const AVIOInterruptCB *int_cb) { + const URLProtocol **protocols; char proto_str[128], proto_nested[128], *ptr; size_t proto_len = strspn(filename, URL_SCHEME_CHARS); int i; @@ -152,13 +153,18 @@ int ffurl_alloc(URLContext **puc, const char *filename, int flags, if ((ptr = strchr(proto_nested, '+'))) *ptr = '\0'; - for (i = 0; ff_url_protocols[i]; i++) { - const URLProtocol *up = ff_url_protocols[i]; - if (!strcmp(proto_str, up->name)) + protocols = ffurl_get_protocols(NULL, NULL); + for (i = 0; protocols[i]; i++) { + const URLProtocol *up = protocols[i]; + if (!strcmp(proto_str, up->name)) { + av_freep(&protocols); return url_alloc_for_protocol(puc, up, filename, flags, int_cb); + } if (up->flags & URL_PROTOCOL_FLAG_NESTED_SCHEME && - !strcmp(proto_nested, up->name)) + !strcmp(proto_nested, up->name)) { + av_freep(&protocols); return url_alloc_for_protocol(puc, up, filename, flags, int_cb); + } } *puc = NULL; return AVERROR_PROTOCOL_NOT_FOUND; |