diff mbox

[FFmpeg-devel] lavf/utils: Do not read "@" without ":" as user name separator

Message ID CAB0OVGoEQSjkKvkK44NJyU-BTtNys7tGDg4zF3iqd+Bs2rNNYw@mail.gmail.com
State Rejected
Headers show

Commit Message

Carl Eugen Hoyos May 5, 2019, 7:13 p.m. UTC
Am So., 5. Mai 2019 um 21:08 Uhr schrieb Carl Eugen Hoyos <ceffmpeg@gmail.com>:
>
> Hi!
>
> Attached patch fixes ticket #7871 without re-introducing #7816.

And with the attachment.

Carl Eugen
diff mbox

Patch

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(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index a63d71b0f4..c8d7f82a55 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -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