changeset 12522:897bda2dfe29

Buffer overflow fix in string handling, patch by c0ntex, approved by .so.
author diego
date Wed, 02 Jun 2004 12:40:41 +0000
parents 27ed4672c619
children e10a934b32cd
files Gui/mplayer/common.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Gui/mplayer/common.c	Wed Jun 02 06:48:25 2004 +0000
+++ b/Gui/mplayer/common.c	Wed Jun 02 12:40:41 2004 +0000
@@ -43,8 +43,8 @@
    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 );