From 2bad32fb698fd19c096cd127b9741f8399b1f398 Mon Sep 17 00:00:00 2001 From: diego Date: Wed, 2 Jun 2004 12:40:41 +0000 Subject: [PATCH] Buffer overflow fix in string handling, patch by c0ntex, approved by .so. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12523 b3059339-0415-0410-9bf9-f77b7e298cf2 --- Gui/mplayer/common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gui/mplayer/common.c b/Gui/mplayer/common.c index 69528c3b7b..861227abf1 100644 --- a/Gui/mplayer/common.c +++ b/Gui/mplayer/common.c @@ -43,8 +43,8 @@ inline void TranslateFilename( int c,char * tmp ) case STREAMTYPE_FILE: if ( ( guiIntfStruct.Filename )&&( guiIntfStruct.Filename[0] ) ) { - if ( strrchr( guiIntfStruct.Filename,'/' ) ) strcpy( tmp,strrchr( guiIntfStruct.Filename,'/' ) + 1 ); - else strcpy( tmp,guiIntfStruct.Filename ); + if ( strrchr( guiIntfStruct.Filename,'/' ) ) strncpy( tmp,strrchr( guiIntfStruct.Filename,'/' ) + 1, 511 ); + else strncpy( tmp,guiIntfStruct.Filename , 511); if ( tmp[strlen( tmp ) - 4] == '.' ) tmp[strlen( tmp ) - 4]=0; if ( tmp[strlen( tmp ) - 5] == '.' ) tmp[strlen( tmp ) - 5]=0; } else strcpy( tmp,MSGTR_NoFileLoaded );