diff options
author | Maxim Andreev <andreevmaxim@gmail.com> | 2016-01-13 11:51:12 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2016-01-15 17:39:04 +0100 |
commit | e183075dc11b2033f3f84bf8c94bd4b31266e90d (patch) | |
tree | 6f2db8d0333aa1c9e558d3499b4a4bdb048049ec | |
parent | a7dea6f2cdce5877845b5cce810e3784628f9388 (diff) | |
download | ffmpeg-e183075dc11b2033f3f84bf8c94bd4b31266e90d.tar.gz |
avformat/hls: forbid all protocols except http(s) & file
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 7145e80b4f78cff5ed5fee04d4c4d53daaa0e077)
Conflicts:
libavformat/hls.c
-rw-r--r-- | libavformat/hls.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libavformat/hls.c b/libavformat/hls.c index f17b826f30..1bd4678b97 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -927,6 +927,12 @@ static int open_input(HLSContext *c, struct playlist *pls) seg->url, seg->url_offset, pls->index); if (seg->key_type == KEY_NONE) { + const char *proto_name = avio_find_protocol_name(seg->url); + if (!av_strstart(proto_name, "http", NULL) && !av_strstart(proto_name, "file", NULL)) { + ret = AVERROR_INVALIDDATA; + goto cleanup; + } + ret = ffurl_open(&pls->input, seg->url, AVIO_FLAG_READ, &pls->parent->interrupt_callback, &opts); @@ -934,6 +940,11 @@ static int open_input(HLSContext *c, struct playlist *pls) char iv[33], key[33], url[MAX_URL_SIZE]; if (strcmp(seg->key, pls->key_url)) { URLContext *uc; + const char *proto_name = avio_find_protocol_name(seg->key); + if (!av_strstart(proto_name, "http", NULL) && !av_strstart(proto_name, "file", NULL)) { + ret = AVERROR_INVALIDDATA; + goto cleanup; + } if (ffurl_open(&uc, seg->key, AVIO_FLAG_READ, &pls->parent->interrupt_callback, &opts2) == 0) { if (ffurl_read_complete(uc, pls->key, sizeof(pls->key)) |