summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2000-07-25 16:21:20 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2000-07-25 16:21:20 +0200
commitd1a3351d0ce15db8edd7385fba5904c6663c5c00 (patch)
tree687f6aadc6002566c3f97d3c2e5e459194d687a2
parent2d3fdc82860fbcd40e67f5aa9ede19809df99ebe (diff)
downloadvdr-d1a3351d0ce15db8edd7385fba5904c6663c5c00.tar.gz
vdr-d1a3351d0ce15db8edd7385fba5904c6663c5c00.tar.bz2
Fixed buffer handling in case of overflow
-rw-r--r--config.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/config.c b/config.c
index d77d07e7..6b5e0493 100644
--- a/config.c
+++ b/config.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: config.c 1.14 2000/07/23 17:22:08 kls Exp $
+ * $Id: config.c 1.15 2000/07/25 16:21:20 kls Exp $
*/
#include "config.h"
@@ -363,8 +363,11 @@ bool cTimer::Parse(const char *s)
if (8 <= sscanf(s, "%d:%d:%a[^:]:%d:%d:%d:%d:%a[^:\n]:%a[^\n]", &active, &channel, &buffer1, &start, &stop, &priority, &lifetime, &buffer2, &summary)) {
//TODO add more plausibility checks
day = ParseDay(buffer1);
- strncpy(file, buffer2, MaxFileName - 1);
- file[strlen(buffer2)] = 0;
+ int l = strlen(buffer2);
+ if (l >= MaxFileName)
+ l = MaxFileName - 1;
+ strncpy(file, buffer2, l);
+ file[l] = 0;
delete buffer1;
delete buffer2;
return day != 0;