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:
reimar 2010-01-27 19:42:24 +00:00
parent d1ec4a57ba
commit 4526f4da65
2 changed files with 4 additions and 4 deletions

View File

@ -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;

View File

@ -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] == ';' )
{