Changeset 389c19e1729f20371fcb0a6294a00ca32966ab27

Show
Ignore:
Timestamp:
30/12/07 19:40:53 (1 year ago)
Author:
Rafaël Carré <funman@videolan.org>
git-committer:
Rafaël Carré <funman@videolan.org> 1199040053 +0000
git-parent:

[7b9e1799ee5a6330222f62801abb29f15750611c]

git-author:
Rafaël Carré <funman@videolan.org> 1199040053 +0000
Message:

fix #1244

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/demux/playlist/xspf.c

    r7b9e179 r389c19e  
    538538                    if( psz_uri ) 
    539539                    { 
    540                         if( p_demux->p_sys->psz_base && 
     540                        if( ( p_demux->p_sys->psz_base || 
     541                              strrchr( p_demux->psz_path, DIR_SEP_CHAR ) ) && 
    541542                            !strstr( psz_uri, "://" ) ) 
    542543                        { 
    543                            char* psz_tmp = malloc( 
    544                                    strlen(p_demux->p_sys->psz_base) + 
    545                                    strlen(psz_uri) +1 ); 
     544                           char *psz_baseref = p_demux->p_sys->psz_base; 
     545                           size_t i_baselen; 
     546                           if( psz_baseref ) 
     547                               i_baselen = strlen( psz_baseref ); 
     548                           else 
     549                           { 
     550                               psz_baseref = p_demux->psz_path; 
     551                               i_baselen = strrchr( psz_baseref, DIR_SEP_CHAR ) 
     552                                            - psz_baseref + 1; 
     553                           } 
     554                           char* psz_tmp = malloc( i_baselen + 
     555                                   strlen( psz_uri ) + 1 ); 
    546556                           if( !psz_tmp ) 
    547557                           { 
     
    549559                               return VLC_FALSE; 
    550560                           } 
    551                            sprintf( psz_tmp, "%s%s", 
    552                                     p_demux->p_sys->psz_base, psz_uri ); 
     561                           strncpy( psz_tmp, psz_baseref, i_baselen ); 
     562                           strcpy( psz_tmp + i_baselen, psz_uri ); 
    553563                           free( psz_uri ); 
    554564                           psz_uri = psz_tmp;