[MPlayer-cvslog] r32796 - trunk/gui/mplayer/gui_common.c
ib
subversion at mplayerhq.hu
Tue Jan 18 12:39:49 CET 2011
Author: ib
Date: Tue Jan 18 12:39:49 2011
New Revision: 32796
Log:
Correct translation of filenames and prevent out-of-bounds array access
Modified:
trunk/gui/mplayer/gui_common.c
Modified: trunk/gui/mplayer/gui_common.c
==============================================================================
--- trunk/gui/mplayer/gui_common.c Tue Jan 18 12:30:46 2011 (r32795)
+++ trunk/gui/mplayer/gui_common.c Tue Jan 18 12:39:49 2011 (r32796)
@@ -54,6 +54,7 @@ static inline void TranslateFilename( in
{
int i;
char * p;
+ size_t len;
switch ( guiIntfStruct.StreamType )
{
@@ -67,8 +68,10 @@ static inline void TranslateFilename( in
av_strlcpy(tmp, p + 1, tmplen);
else
av_strlcpy(tmp, guiIntfStruct.Filename, tmplen);
- if ( tmp[strlen( tmp ) - 4] == '.' ) tmp[strlen( tmp ) - 4]=0;
- if ( tmp[strlen( tmp ) - 5] == '.' ) tmp[strlen( tmp ) - 5]=0;
+ len=strlen( tmp );
+ if ( ( len > 3 )&&( tmp[len - 3] == '.' ) ) tmp[len - 3]=0;
+ else if ( ( len > 4 )&&( tmp[len - 4] == '.' ) ) tmp[len - 4]=0;
+ else if ( ( len > 5 )&&( tmp[len - 5] == '.' ) ) tmp[len - 5]=0;
} else av_strlcpy( tmp,MSGTR_NoFileLoaded,tmplen );
break;
#ifdef CONFIG_DVDREAD
More information about the MPlayer-cvslog
mailing list