[Mplayer-cvslog] CVS: 0_90/libvo vo_dxr3.c,1.117,1.118

Diego Biurrun CVS syncmail at mplayerhq.hu
Thu Jul 1 12:22:30 CEST 2004


CVS change done by Diego Biurrun CVS

Update of /cvsroot/mplayer/0_90/libvo
In directory mail:/var2/tmp/cvs-serv26448/libvo

Modified Files:
	vo_dxr3.c 
Log Message:
string handling security fixes ported from main


Index: vo_dxr3.c
===================================================================
RCS file: /cvsroot/mplayer/0_90/libvo/vo_dxr3.c,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -r1.117 -r1.118
--- vo_dxr3.c	10 Mar 2003 15:57:17 -0000	1.117
+++ vo_dxr3.c	1 Jul 2004 10:22:27 -0000	1.118
@@ -171,12 +171,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 */
@@ -855,7 +857,7 @@
 
 static uint32_t preinit(const char *arg)
 {
-	char devname[80];
+	char devname[MAX_STR_SIZE];
 	int fdflags = O_WRONLY;
 
 	/* Parse commandline */
@@ -1128,13 +1130,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;
@@ -1191,10 +1193,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))
@@ -1202,7 +1204,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