Changeset 09ffa83994759a32ab35b90ad4bade5bf71ccec4

Show
Ignore:
Timestamp:
06/06/07 18:40:48 (1 year ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1181148048 +0000
git-parent:

[b88d6d15440ec6cee17f382c6147b8ff04d2051f]

git-author:
Rémi Denis-Courmont <rem@videolan.org> 1181148048 +0000
Message:

- Only allow letters, digits and slash in access/demux specification

(fixes problem with most-but-not-all filenames containing a colon)

- Only allow letters as Windows drives

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/input/input.c

    r9d8ceda r09ffa83  
    25382538} 
    25392539 
     2540 
     2541static inline vlc_bool_t IsValidAccess( const char *psz ) 
     2542{ 
     2543    unsigned char c; 
     2544 
     2545    while( ( c = *psz ) != '\0' ) 
     2546    { 
     2547        if( c == ':' ) 
     2548            return VLC_TRUE; 
     2549 
     2550        if( !isascii( c ) || !isalnum( c ) || ( c != '/' ) ) 
     2551            return VLC_FALSE; 
     2552 
     2553        psz++; 
     2554    } 
     2555    return VLC_FALSE; /* should not happen though */ 
     2556} 
     2557 
     2558 
    25402559/***************************************************************************** 
    25412560 * MRLSplit: parse the access, demux and url part of the 
     
    25492568    const char *psz_demux  = ""; 
    25502569    char *psz_path; 
    2551     char *psz, *psz_check
     2570    char *psz
    25522571 
    25532572    psz = strchr( psz_dup, ':' ); 
    25542573 
    2555     /* '@' not allowed in access/demux part */ 
    2556     psz_check = strchr( psz_dup, '@' ); 
    2557     if( psz_check && psz_check < psz ) psz = 0; 
    2558  
     2574    if( psz != NULL ) 
     2575    { 
     2576        /* Guess whether ':' is part of a local filename, or separates 
     2577         * access/demux from path */ 
     2578        if( !IsValidAccess( psz_dup ) ) 
     2579            psz = NULL; 
    25592580#if defined( WIN32 ) || defined( UNDER_CE ) 
    2560     if( psz - psz_dup == 1 ) 
    2561     { 
    2562         msg_Dbg( p_input, "drive letter %c: found in source", *psz_dup ); 
    2563         psz_path = psz_dup; 
    2564     } 
    2565     else 
     2581        else if( ( psz - psz_dup == 1 ) && isalpha( psz_dup[0] ) ) 
     2582        { 
     2583            msg_Dbg( p_input, "drive letter %c: found in source", *psz_dup ); 
     2584            psz = NULL; 
     2585        } 
    25662586#endif 
    2567  
    2568     if( psz ) 
     2587    } 
     2588 
     2589    if( psz != NULL ) 
    25692590    { 
    25702591        *psz++ = '\0';