Changeset 45915c74f0baaaed6527dc888f3e4263fb50e7d7

Show
Ignore:
Timestamp:
21/08/07 20:02:43 (1 year ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1187719363 +0000
git-parent:

[9b84d144a7c957beab0f5ba38fd48b481984014e]

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

Fix utf8_readdir usage

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/control/http/util.c

    r9e595c9 r45915c7  
    150150    msg_Dbg( p_intf, "dir=%s", psz_dir ); 
    151151 
    152     sprintf( dir, "%s%c.access", psz_dir, sep ); 
     152    snprintf( dir, sizeof( dir ), "%s%c.access", psz_dir, sep ); 
    153153    if( ( file = utf8_fopen( dir, "r" ) ) != NULL ) 
    154154    { 
     
    184184    } 
    185185 
    186     sprintf( dir, "%s%c.hosts", psz_dir, sep ); 
     186    snprintf( dir, sizeof( dir ), "%s%c.hosts", psz_dir, sep ); 
    187187    p_acl = ACL_Create( p_intf, VLC_FALSE ); 
    188188    if( ACL_LoadFile( p_acl, dir ) ) 
     
    194194    for( ;; ) 
    195195    { 
    196         const char *psz_filename; 
     196        char *psz_filename; 
    197197        /* parse psz_src dir */ 
    198198        if( ( psz_filename = utf8_readdir( p_dir ) ) == NULL ) 
     
    203203        if( ( psz_filename[0] == '.' ) 
    204204         || ( i_dirlen + strlen( psz_filename ) > MAX_DIR_SIZE ) ) 
     205        { 
     206            free( psz_filename ); 
    205207            continue; 
    206  
    207         sprintf( dir, "%s%c%s", psz_dir, sep, psz_filename ); 
    208         free( (char*) psz_filename ); 
     208        } 
     209 
     210        snprintf( dir, sizeof( dir ), "%s%c%s", psz_dir, sep, psz_filename ); 
     211        free( psz_filename ); 
    209212 
    210213        if( E_(ParseDirectory)( p_intf, psz_root, dir ) ) 
  • modules/demux/mkv.cpp

    r81c5ac2 r45915c7  
    15331533                        if (!s_filename.compare(p_demux->psz_path)) 
    15341534#endif 
     1535                        { 
     1536                            free (psz_file); 
    15351537                            continue; // don't reuse the original opened file 
     1538                        } 
    15361539 
    15371540#if defined(__GNUC__) && (__GNUC__ < 3) 
  • modules/gui/ncurses.c

    r9e595c9 r45915c7  
    2828 * Preamble 
    2929 *****************************************************************************/ 
     30#include <vlc/vlc.h> 
     31 
    3032#include <errno.h>                                                 /* ENOMEM */ 
    3133#include <time.h> 
     
    3335#include <curses.h> 
    3436 
    35 #include <vlc/vlc.h> 
    3637#include <vlc_interface.h> 
    3738#include <vlc_vout.h> 
     
    19281929        p_sys->i_dir_entries = 0; 
    19291930 
    1930         /* get the first directory entry */ 
    1931         psz_entry = utf8_readdir( p_current_dir ); 
    1932  
    19331931        /* while we still have entries in the directory */ 
    1934         while( psz_entry != NULL ) 
     1932        while( ( psz_entry = utf8_readdir( p_current_dir ) ) != NULL ) 
    19351933        { 
    19361934#if defined( S_ISDIR ) 
     
    19471945            { 
    19481946                free( psz_entry ); 
    1949                 psz_entry = utf8_readdir( p_current_dir ); 
    19501947                continue; 
    19511948            } 
     
    19561953            if( !( p_dir_entry = malloc( sizeof( struct dir_entry_t) ) ) ) 
    19571954            { 
    1958                 free( psz_uri); 
    1959                 return; 
     1955                free( psz_uri ); 
     1956                free( psz_entry ); 
     1957                continue; 
    19601958            } 
    19611959 
    19621960#if defined( S_ISDIR ) 
    1963             utf8_stat( psz_uri, &stat_data ); 
    1964             if( S_ISDIR(stat_data.st_mode) ) 
     1961            if( !utf8_stat( psz_uri, &stat_data ) 
     1962            && S_ISDIR(stat_data.st_mode) ) 
    19651963/*#elif defined( DT_DIR ) 
    19661964            if( p_dir_content->d_type & DT_DIR )*/ 
     
    19841982            free( psz_uri ); 
    19851983            free( psz_entry ); 
    1986             /* Read next entry */ 
    1987             psz_entry = utf8_readdir( p_current_dir ); 
    19881984        } 
    19891985 
  • src/text/unicode.c

    r1cffa56 r45915c7  
    417417 * @param dir The directory that is being read 
    418418 * 
    419  * @return a UTF-8 string of the directory entry. Use LocaleFree() to free this memory 
     419 * @return a UTF-8 string of the directory entry. Use free() to free this memory. 
    420420 */ 
    421421char *utf8_readdir( DIR *dir )