Changeset 914f20188c38ba6657c578fce381e1b42e651766

Show
Ignore:
Timestamp:
11/01/06 08:50:44 (2 years ago)
Author:
Rafaël Carré <funman@videolan.org>
git-committer:
Rafaël Carré <funman@videolan.org> 1162367444 +0000
git-parent:

[8741be0247e758e02802869b6e2616fc79fa4370]

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

Makes file plugin fail to access directories
Some sanity checks

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/access/file.c

    rf81778e r914f201  
    162162    else 
    163163    { 
     164/* returns early if psz_path is a directory */ 
     165#ifdef HAVE_SYS_STAT_H 
     166        struct stat stat_info; 
     167 
     168        if( utf8_stat( p_access->psz_path, &stat_info ) ) 
     169        { 
     170            msg_Warn( p_access, "%s: %s", p_access->psz_path, 
     171                    strerror( errno ) ); 
     172            return VLC_EGENERIC; 
     173        } 
     174        if S_ISDIR(stat_info.st_mode) 
     175        { 
     176            msg_Warn( p_access, "%s is a directory", p_access->psz_path ); 
     177            return VLC_EGENERIC; 
     178        } 
     179#endif 
     180 
    164181        p_sys->b_seekable = VLC_TRUE; 
    165182        p_sys->b_pace_control = VLC_TRUE; 
     183 
    166184    } 
    167185 
     
    491509static char *expand_path (const access_t *p_access, const char *path) 
    492510{ 
    493     if (strncmp (path, "~/", 2) == 0
     511    if ( ( strlen (path) >= 2 ) && ( strncmp (path, "~/", 2) == 0 )
    494512    { 
    495513        char *res; 
     
    502520 
    503521#if defined(WIN32) 
    504     if (!strcasecmp (p_access->psz_access, "file") 
     522    if ( ( strlen(p_access->psz_access ) >= 4 ) 
     523      && !strcasecmp (p_access->psz_access, "file") 
    505524      && ('/' == path[0]) && path[1] && (':' == path[2]) && ('/' == path[3])) 
    506525        // Explorer can open path such as file:/C:/ or file:///C:/