diff options
Diffstat (limited to 'libavformat/applehttp.c')
-rw-r--r-- | libavformat/applehttp.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c index 3aa7ed4239..1252dc5a68 100644 --- a/libavformat/applehttp.c +++ b/libavformat/applehttp.c @@ -90,7 +90,7 @@ static void make_absolute_url(char *buf, int size, const char *base, const char *rel) { char *sep; - if (!base || strstr(rel, "://")) { + if (!base || strstr(rel, "://") || rel[0] == '/') { av_strlcpy(buf, rel, size); return; } @@ -99,13 +99,15 @@ static void make_absolute_url(char *buf, int size, const char *base, sep = strrchr(buf, '/'); if (sep) sep[1] = '\0'; - while (av_strstart(rel, "../", NULL)) { - if (sep) { + else + buf[0] = '\0'; + while (av_strstart(rel, "../", NULL) && sep) { sep[0] = '\0'; sep = strrchr(buf, '/'); if (sep) sep[1] = '\0'; - } + else + buf[0] = '\0'; rel += 3; } av_strlcat(buf, rel, size); |