Commit 47a67b90 authored by Laurent Aimar's avatar Laurent Aimar

Improved vlc_UrlParse (close #1025)

 We use vlc_UrlParse for "URL" without protocol... so it was using a part of
the URL as a protocol if it found ":/". Ensure to extract only valid protocol
at least.
parent f5305fef
......@@ -73,7 +73,23 @@ static inline void vlc_UrlParse( vlc_url_t *url, const char *psz_url,
}
url->psz_buffer = psz_parse = psz_dup = strdup( psz_url );
/* Search a valid protocol */
p = strstr( psz_parse, ":/" );
if( p != NULL )
{
char *p2;
for( p2 = psz_parse; p2 < p; p2++ )
{
#define I(i,a,b) ( (a) <= (i) && (i) <= (b) )
if( !I(*p2, 'a', 'z' ) && !I(*p2, 'A', 'Z') && !I(*p2, '0', '9') && *p2 != '+' && *p2 != '-' && *p2 != '.' )
{
p = NULL;
break;
}
#undef I
}
}
if( p != NULL )
{
/* we have a protocol */
......
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