[vlc-devel] [PATCH] audioscrobbler: fix url parsing in handshake

Pierre Lamot pierre at videolabs.io
Wed May 16 13:24:50 CEST 2018


  vlc_UrlParse expects the scheme to be present

  fixes: #19415 #19916
---
 modules/misc/audioscrobbler.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/modules/misc/audioscrobbler.c b/modules/misc/audioscrobbler.c
index 1de21059a9..e4e31b637d 100644
--- a/modules/misc/audioscrobbler.c
+++ b/modules/misc/audioscrobbler.c
@@ -602,7 +602,6 @@ static int Handshake(intf_thread_t *p_this)
         goto proto;
 
     /* We need to read the nowplaying url */
-    p_buffer_pos += 7; /* we skip "http://" */
     psz_url = strndup(p_buffer_pos, strcspn(p_buffer_pos, "\n"));
     if (!psz_url)
         goto oom;
@@ -615,13 +614,13 @@ static int Handshake(intf_thread_t *p_this)
         vlc_UrlClean(&p_sys->p_nowp_url);
         goto proto;
     }
+    p_buffer_pos += strcspn(p_buffer_pos, "\n");
 
     p_buffer_pos = strstr(p_buffer_pos, "http://");
     if (!p_buffer_pos || strlen(p_buffer_pos) == 7)
         goto proto;
 
     /* We need to read the submission url */
-    p_buffer_pos += 7; /* we skip "http://" */
     psz_url = strndup(p_buffer_pos, strcspn(p_buffer_pos, "\n"));
     if (!psz_url)
         goto oom;
-- 
2.14.1



More information about the vlc-devel mailing list