From 969e30264d4f64885a943d347a5fa397efc0cd17 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Sun, 5 May 2019 21:05:40 +0200
Subject: [PATCH] lavf/utils: Do not read "@" without ":" as user name
separator.
Fixes ticket #7871.
---
libavformat/utils.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
@@ -4730,7 +4730,7 @@ void av_url_split(char *proto, int proto_size,
char *hostname, int hostname_size,
int *port_ptr, char *path, int path_size, const char *url)
{
- const char *p, *ls, *ls2, *ls3, *at, *at2, *col, *brk;
+ const char *p, *ls, *ls2, *ls3, *ls4, *at, *at2, *col, *brk;
if (port_ptr)
*port_ptr = -1;
@@ -4761,7 +4761,8 @@ void av_url_split(char *proto, int proto_size,
ls = strchr(p, '/');
ls2 = strchr(p, '?');
ls3 = strchr(p, '@');
- if (ls3 && ls3 > ls && (!ls2 || ls2 > ls3))
+ ls4 = strchr(p, ':');
+ if (ls3 && ls3 > ls && (!ls2 || ls2 > ls3) && ls4 && ls4 < ls3)
ls = strchr(ls3, '/');
if (!ls)
ls = ls2;
--
2.21.0