Changeset 1684a6ae8733789c2ea9d41e0c45fd75832aea3d

Show
Ignore:
Timestamp:
23/03/07 19:48:04 (2 years ago)
Author:
Laurent Aimar <fenrir@videolan.org>
git-committer:
Laurent Aimar <fenrir@videolan.org> 1174675684 +0000
git-parent:

[042f53c95bf6d6c58573d1a56bde0785002ff2c2]

git-author:
Laurent Aimar <fenrir@videolan.org> 1174675684 +0000
Message:

Fixed dvbsi_to_utf8 (memory leak + possible segfault)

Files:

Legend:

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

    r6185bee r1684a6a  
    23102310} 
    23112311 
     2312static inline void *FixUTF8( char *p ) 
     2313{ 
     2314    EnsureUTF8( p ); 
     2315    return p; 
     2316} 
     2317 
    23122318static char *dvbsi_to_utf8( char *psz_instring, size_t i_length ) 
    23132319{ 
     
    23182324    vlc_iconv_t iconv_handle; 
    23192325    if( i_length < 1 ) return NULL; 
    2320     if( psz_instring[0] >= 0x20 ) 
     2326    if( psz_instring[0] < 0 || psz_instring[0] >= 0x20 ) 
    23212327    { 
    23222328        psz_stringstart = psz_instring; 
     
    23712377        if( i_length < 3 || psz_instring[1] != '\0' || psz_instring[2] > 0x0f 
    23722378            || psz_instring[2] == 0 ) 
    2373             return EnsureUTF8(strndup(psz_instring,i_length)); 
     2379            return FixUTF8(strndup(psz_instring,i_length)); 
    23742380        sprintf( psz_encbuf, "ISO_8859-%d", psz_instring[2] ); 
    23752381        psz_stringstart = &psz_instring[3]; 
     
    23932399        break; 
    23942400    case 0x15: 
    2395         return EnsureUTF8(strndup(&psz_instring[1],i_length-1)); 
     2401        return FixUTF8(strndup(&psz_instring[1],i_length-1)); 
    23962402        break; 
    23972403    default: 
    23982404        /* invalid */ 
    2399         return EnsureUTF8(strndup(psz_instring,i_length)); 
     2405        return FixUTF8(strndup(psz_instring,i_length)); 
    24002406    } 
    24012407    iconv_handle = vlc_iconv_open( "UTF-8", psz_encoding );