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

Message ID 20050806143034.GA10801@suse.de
State New
Headers

Commit Message

Ludwig Nussel Aug. 6, 2005, 2:30 p.m. UTC
  Hi,

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


cu
Ludwig
  

Comments

Ludwig Nussel Aug. 6, 2005, 2:32 p.m. UTC | #1
Ludwig Nussel wrote:
> The problem addressed by the second hunk obviously worked by
> accident with previous gcc and breaks with gcc4.

Ok, this was added by the ElchiAIO patch.

cu
Ludwig
  

Patch

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);