From bc72b7e6cd2468a9f8daea34dba524d81d60702f Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Mon, 11 Mar 2013 11:07:59 +0100 Subject: Fixed using PATH_MAX and NAME_MAX (+/-1 because the first one includes the terminating 0, while the latter doesn't) --- HISTORY | 2 ++ config.h | 8 ++++---- recording.c | 4 ++-- timers.h | 4 ++-- vdr.c | 8 ++++---- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/HISTORY b/HISTORY index 76088eab..cd04deb7 100644 --- a/HISTORY +++ b/HISTORY @@ -7735,3 +7735,5 @@ Video Disk Recorder Revision History - Updated the Hungarian OSD texts (thanks to István Füley). - Updated the Russian OSD texts (thanks to Oleg Roitburd). - Updated the Polish OSD texts (thanks to Marek Nazarko). +- Fixed using PATH_MAX and NAME_MAX (+/-1 because the first one includes the + terminating 0, while the latter doesn't). diff --git a/config.h b/config.h index 5e1e3ff5..f7b3795f 100644 --- a/config.h +++ b/config.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.h 2.72 2013/03/10 15:52:11 kls Exp $ + * $Id: config.h 2.74 2013/03/11 11:07:59 kls Exp $ */ #ifndef __CONFIG_H @@ -27,8 +27,8 @@ // The plugin API's version number: -#define APIVERSION "1.7.40" -#define APIVERSNUM 10740 // Version * 10000 + Major * 100 + Minor +#define APIVERSION "1.7.41" +#define APIVERSNUM 10741 // Version * 10000 + Major * 100 + Minor // When loading plugins, VDR searches them by their APIVERSION, which // may be smaller than VDRVERSION in case there have been no changes to @@ -260,7 +260,7 @@ public: int MenuScrollWrap; int MenuKeyCloses; int MarkInstantRecord; - char NameInstantRecord[NAME_MAX]; + char NameInstantRecord[NAME_MAX + 1]; int InstantRecordTime; int LnbSLOF; int LnbFrequLo; diff --git a/recording.c b/recording.c index 032175dd..f43ce52e 100644 --- a/recording.c +++ b/recording.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recording.c 2.90 2013/03/04 14:02:40 kls Exp $ + * $Id: recording.c 2.91 2013/03/11 10:34:41 kls Exp $ */ #include "recording.h" @@ -66,7 +66,7 @@ #define MAX_LINK_LEVEL 6 -int DirectoryPathMax = PATH_MAX; +int DirectoryPathMax = PATH_MAX - 1; int DirectoryNameMax = NAME_MAX; bool DirectoryEncoding = false; int InstanceId = 0; diff --git a/timers.h b/timers.h index adc55096..8910c106 100644 --- a/timers.h +++ b/timers.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: timers.h 2.6 2013/02/05 11:23:24 kls Exp $ + * $Id: timers.h 2.7 2013/03/11 10:35:53 kls Exp $ */ #ifndef __TIMERS_H @@ -39,7 +39,7 @@ private: int stop; int priority; int lifetime; - mutable char file[NAME_MAX * 2]; // *2 to be able to hold 'title' and 'episode', which can each be up to 255 characters long + mutable char file[NAME_MAX * 2 + 1]; // *2 to be able to hold 'title' and 'episode', which can each be up to 255 characters long char *aux; const cEvent *event; public: diff --git a/vdr.c b/vdr.c index f46589f5..4b23312b 100644 --- a/vdr.c +++ b/vdr.c @@ -22,7 +22,7 @@ * * The project's page is at http://www.tvdr.de * - * $Id: vdr.c 2.50 2013/03/03 10:25:11 kls Exp $ + * $Id: vdr.c 2.51 2013/03/11 10:31:24 kls Exp $ */ #include @@ -281,7 +281,7 @@ int main(int argc, char *argv[]) case 'd' | 0x100: { char *s = optarg; int n = strtol(s, &s, 10); - if (n <= 0 || n >= PATH_MAX) { + if (n <= 0 || n >= PATH_MAX) { // PATH_MAX includes the terminating 0 fprintf(stderr, "vdr: invalid directory path length: %s\n", optarg); return 2; } @@ -293,7 +293,7 @@ int main(int argc, char *argv[]) return 2; } n = strtol(s, &s, 10); - if (n <= 0 || n >= NAME_MAX) { + if (n <= 0 || n > NAME_MAX) { // NAME_MAX excludes the terminating 0 fprintf(stderr, "vdr: invalid directory name length: %s\n", optarg); return 2; } @@ -530,7 +530,7 @@ int main(int argc, char *argv[]) "\n", DEFAULTCACHEDIR, DEFAULTCONFDIR, - PATH_MAX, + PATH_MAX - 1, NAME_MAX, DEFAULTEPGDATAFILENAME, MAXVIDEOFILESIZEDEFAULT, -- cgit v1.2.3