diff options
author | Steven Liu <lq@chinaffmpeg.org> | 2020-05-28 10:41:25 +0800 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2020-06-14 21:04:07 +0200 |
commit | cfec756a6d63163ef7982c53b11e9f9bdb0555b0 (patch) | |
tree | 4aec4fb1ad4694a4d784546784b7123b24db922e | |
parent | 569a9d3d70324cf77391820155846a5b9d429ad5 (diff) | |
download | ffmpeg-cfec756a6d63163ef7982c53b11e9f9bdb0555b0.tar.gz |
avformat/url: check return value of strchr
fix ticket: 8687
workflow should return if there have no value of strchr
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
(cherry picked from commit 029ff31af6801dd2bca1b543575e17eaaa6b0772)
-rw-r--r-- | libavformat/url.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/url.c b/libavformat/url.c index 6956f6dc10..20463a6674 100644 --- a/libavformat/url.c +++ b/libavformat/url.c @@ -90,6 +90,8 @@ static void trim_double_dot_url(char *buf, const char *rel, int size) if (p && (sep = strstr(p, "://"))) { sep += 3; root = strchr(sep, '/'); + if (!root) + return; } /* set new current position if the root node is changed */ @@ -150,6 +152,7 @@ void ff_make_absolute_url(char *buf, int size, const char *base, } /* If rel actually is an absolute url, just copy it */ if (!base || strstr(rel, "://") || rel[0] == '/') { + memset(buf, 0, size); trim_double_dot_url(buf, rel, size); return; } @@ -177,6 +180,8 @@ void ff_make_absolute_url(char *buf, int size, const char *base, if (sep) { sep += 3; root = strchr(sep, '/'); + if (!root) + return; } } |