[Mplayer-cvslog] CVS: main/libvo vo_dxr3.c,1.119,1.120

Diego Biurrun CVS syncmail at mplayerhq.hu
Fri Jun 25 18:49:54 CEST 2004


CVS change done by Diego Biurrun CVS

Update of /cvsroot/mplayer/main/libvo
In directory mail:/var2/tmp/cvs-serv17907/libvo

Modified Files:
	vo_dxr3.c 
Log Message:
string handling security fixes
patch by Nicholas Kain, Alexander Strasser <eclipse7 at gmx.net>
reviewed by Pontscho, Alex, Rich


Index: vo_dxr3.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_dxr3.c,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -r1.119 -r1.120
--- vo_dxr3.c	30 Nov 2003 16:36:10 -0000	1.119
+++ vo_dxr3.c	25 Jun 2004 16:49:51 -0000	1.120
@@ -175,12 +175,14 @@
 int dxr3_device_num = 0;
 int dxr3_norm = 0;
 
+#define MAX_STR_SIZE 80 /* length for the static strings  */
+
 /* File descriptors */
 static int fd_control = -1;
 static int fd_video = -1;
 static int fd_spu = -1;
-static char fdv_name[80];
-static char fds_name[80];
+static char fdv_name[MAX_STR_SIZE];
+static char fds_name[MAX_STR_SIZE];
 
 #ifdef SPU_SUPPORT
 /* on screen display/subpics */
@@ -865,7 +867,7 @@
 
 static uint32_t preinit(const char *arg)
 {
-	char devname[80];
+	char devname[MAX_STR_SIZE];
 	int fdflags = O_WRONLY;
 
 	/* Parse commandline */
@@ -1136,13 +1138,13 @@
     int j;
 	
     if(!p) {
-	strcpy(fname,getenv("HOME"));
-	strcat(fname,"/.overlay");	    
+	strlcpy(fname, getenv("HOME"), sizeof( fname ));
+	strlcat(fname,"/.overlay", sizeof( fname ));	    
     } else
-	strcpy(fname,p);
+	strlcpy(fname, p, sizeof( fname ));
     
     sprintf(tmp,"/res_%dx%dx%d",o->xres,o->yres,o->depth);
-    strcat(fname,tmp);
+    strlcat(fname, tmp, sizeof( fname ));
 
     if(!(fp=fopen(fname,"r")))
 	return -1;
@@ -1199,10 +1201,10 @@
     int i,j;
 	
     if(!p) {
-	strcpy(fname,getenv("HOME"));
-	strcat(fname,"/.overlay");	    
+	strlcpy(fname, getenv("HOME"), sizeof( fname ));
+	strlcat(fname,"/.overlay", sizeof( fname ));	    
     } else
-	strcpy(fname,p);
+	strlcpy(fname, p, sizeof( fname ));
 
     if(access(fname, W_OK|X_OK|R_OK)) {
 	if(mkdir(fname,0766))
@@ -1210,7 +1212,7 @@
     }	
     
     sprintf(tmp,"/res_%dx%dx%d",o->xres,o->yres,o->depth);
-    strcat(fname,tmp);
+    strlcat(fname, tmp, sizeof( fname ));
     
     if(!(fp=fopen(fname,"w")))
 	return -1;




More information about the MPlayer-cvslog mailing list