[vdr] [PATCH] vdr-1.2.6 off by ones in recording.c show up with gcc4

Ludwig Nussel ludwig.nussel at suse.de
Sat Aug 6 16:30:35 CEST 2005


Hi,

The problem addressed by the second hunk obviously worked by
accident with previous gcc and breaks with gcc4.

Index: vdr-1.2.6/recording.c
===================================================================
--- vdr-1.2.6.orig/recording.c
+++ vdr-1.2.6/recording.c
@@ -512,7 +512,7 @@ const char *cRecording::Title(char Delim
      last = -1;
      index = NULL;
      char filename[199]="";
-     sprintf(filename, "%s", FileName());
+     snprintf(filename, sizeof(filename), "%s", FileName());
      if (filename) {
         fileName = MALLOC(char, strlen(filename) + strlen(INDEXFILESUFFIX) + 1);
         if (fileName) {
@@ -548,8 +548,8 @@ const char *cRecording::Title(char Delim
 		   }	  
 	    }
      }
-	 char RecDate[5]="";
-	 char RecTime[5]="";
+	 char RecDate[6]="";
+	 char RecTime[6]="";
 	 char DummyDelimiter = ' '; 
 	 sprintf(RecDate,"%02d.%02d", t->tm_mday, t->tm_mon + 1);
 	 sprintf(RecTime,"%02d:%02d", t->tm_hour, t->tm_min);

cu
Ludwig

-- 
 (o_   Ludwig Nussel
 //\   SUSE LINUX Products GmbH, Development
 V_/_  http://www.suse.de/



More information about the vdr mailing list