aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-03-14 21:32:35 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-06-10 02:13:10 +0200
commit9c10ef55b0aa97894b841076c3b893f42235b89a (patch)
tree8a6d565418c9f730c52ee9a63c5d5ed85b4f6d5c
parentdece653d0de93ab4b362e6e888a98045e929f7fe (diff)
downloadffmpeg-9c10ef55b0aa97894b841076c3b893f42235b89a.tar.gz
avformat/mov: Disallow ".." in dref unless use_absolute_path is set
as this kind of allows to circumvent it to some extend. We also could add a separate parameter or value to choose this Found-by: ramiro Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 1e4d0498df6621143da1a550006ddc3526ad51cb) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/mov.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 512e8bbd41..52d93ee559 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2223,6 +2223,9 @@ static int mov_open_dref(AVIOContext **pb, const char *src, MOVDref *ref,
av_strlcat(filename, "../", sizeof(filename));
av_strlcat(filename, ref->path + l + 1, sizeof(filename));
+ if (!use_absolute_path)
+ if(strstr(ref->path + l + 1, "..") || ref->nlvl_from > 1)
+ return AVERROR(ENOENT);
if (strlen(filename) + 1 == sizeof(filename))
return AVERROR(ENOENT);