Commit 9d3fbd00 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

XSPF: remove harmful base decoding

(cherry picked from commit 993d4fcc)

Conflicts:

	modules/demux/playlist/xspf.c
parent f42e1999
...@@ -210,7 +210,7 @@ static bool parse_playlist_node COMPLEX_INTERFACE ...@@ -210,7 +210,7 @@ static bool parse_playlist_node COMPLEX_INTERFACE
; ;
else if( !strcmp( psz_name, "xml:base" ) ) else if( !strcmp( psz_name, "xml:base" ) )
{ {
p_demux->p_sys->psz_base = decode_URI_duplicate( psz_value ); p_demux->p_sys->psz_base = strdup( psz_value );
} }
/* unknown attribute */ /* unknown attribute */
else else
...@@ -546,21 +546,18 @@ static bool parse_track_node COMPLEX_INTERFACE ...@@ -546,21 +546,18 @@ static bool parse_track_node COMPLEX_INTERFACE
/* special case: location */ /* special case: location */
if( !strcmp( p_handler->name, "location" ) ) if( !strcmp( p_handler->name, "location" ) )
{ {
char *psz_location = psz_value; /* FIXME: This is broken. Scheme-relative (//...) locations
if( !strncmp( psz_value, "file://", 7 ) ) * and anchors (#...) are not resolved correctly. Also,
psz_location = decode_URI( psz_value + 7 ); * host-relative (/...) and directory-relative locations
* ("relative path" in vernacular) should be resolved.
if( !psz_location ) * Last, psz_base should default to the XSPF resource
{ * location if missing (not the current working directory).
FREE_ATT(); * -- Courmisch */
return false;
}
if( p_demux->p_sys->psz_base && !strstr( psz_value, "://" ) ) if( p_demux->p_sys->psz_base && !strstr( psz_value, "://" ) )
{ {
char* psz_tmp; char* psz_tmp;
if( asprintf( &psz_tmp, "%s%s", p_demux->p_sys->psz_base, if( asprintf( &psz_tmp, "%s%s", p_demux->p_sys->psz_base,
psz_location ) == -1 ) psz_value ) == -1 )
{ {
FREE_ATT(); FREE_ATT();
return NULL; return NULL;
...@@ -569,7 +566,7 @@ static bool parse_track_node COMPLEX_INTERFACE ...@@ -569,7 +566,7 @@ static bool parse_track_node COMPLEX_INTERFACE
free( psz_tmp ); free( psz_tmp );
} }
else else
input_item_SetURI( p_new_input, psz_location ); input_item_SetURI( p_new_input, psz_value );
input_item_CopyOptions( p_input_item, p_new_input ); input_item_CopyOptions( p_input_item, p_new_input );
FREE_ATT(); FREE_ATT();
p_handler = NULL; p_handler = NULL;
......
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