Commit cfec756a authored by Steven Liu's avatar Steven Liu Committed by Marton Balint

avformat/url: check return value of strchr

fix ticket: 8687
workflow should return if there have no value of strchr
Signed-off-by: 's avatarSteven Liu <lq@chinaffmpeg.org>
(cherry picked from commit 029ff31af6801dd2bca1b543575e17eaaa6b0772)
parent 569a9d3d
...@@ -90,6 +90,8 @@ static void trim_double_dot_url(char *buf, const char *rel, int size) ...@@ -90,6 +90,8 @@ static void trim_double_dot_url(char *buf, const char *rel, int size)
if (p && (sep = strstr(p, "://"))) { if (p && (sep = strstr(p, "://"))) {
sep += 3; sep += 3;
root = strchr(sep, '/'); root = strchr(sep, '/');
if (!root)
return;
} }
/* set new current position if the root node is changed */ /* 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, ...@@ -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 rel actually is an absolute url, just copy it */
if (!base || strstr(rel, "://") || rel[0] == '/') { if (!base || strstr(rel, "://") || rel[0] == '/') {
memset(buf, 0, size);
trim_double_dot_url(buf, rel, size); trim_double_dot_url(buf, rel, size);
return; return;
} }
...@@ -177,6 +180,8 @@ void ff_make_absolute_url(char *buf, int size, const char *base, ...@@ -177,6 +180,8 @@ void ff_make_absolute_url(char *buf, int size, const char *base,
if (sep) { if (sep) {
sep += 3; sep += 3;
root = strchr(sep, '/'); root = strchr(sep, '/');
if (!root)
return;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment