mirror of https://github.com/mpv-player/mpv
Fix newline removal code that might read and write out of bounds.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30446 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
d1ec4a57ba
commit
4526f4da65
|
@ -87,8 +87,8 @@ int fntRead( char * path,char * fname )
|
|||
{
|
||||
fgets( tmp,255,f ); linenumber++;
|
||||
|
||||
c=tmp[ strlen( tmp ) - 1 ]; if ( ( c == '\n' )||( c == '\r' ) ) tmp[ strlen( tmp ) - 1 ]=0;
|
||||
c=tmp[ strlen( tmp ) - 1 ]; if ( ( c == '\n' )||( c == '\r' ) ) tmp[ strlen( tmp ) - 1 ]=0;
|
||||
// remove any kind of newline, if any
|
||||
tmp[strcspn(tmp, "\n\r")] = 0;
|
||||
for ( c=0;c < (int)strlen( tmp );c++ )
|
||||
if ( tmp[c] == ';' ) { tmp[c]=0; break; }
|
||||
if ( !tmp[0] ) continue;
|
||||
|
|
|
@ -717,8 +717,8 @@ int skinRead( char * dname )
|
|||
{
|
||||
linenumber++;
|
||||
|
||||
c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0;
|
||||
c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0;
|
||||
// remove any kind of newline, if any
|
||||
tmp[strcspn(tmp, "\n\r")] = 0;
|
||||
for ( c=0;c<(int)strlen( tmp );c++ )
|
||||
if ( tmp[c] == ';' )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue