1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Fixed using PATH_MAX and NAME_MAX (+/-1 because the first one includes the terminating 0, while the latter doesn't)

This commit is contained in:
Klaus Schmidinger 2013-03-11 11:07:59 +01:00
parent f3ca6f2083
commit bc72b7e6cd
5 changed files with 14 additions and 12 deletions

View File

@ -7735,3 +7735,5 @@ Video Disk Recorder Revision History
- Updated the Hungarian OSD texts (thanks to István Füley). - Updated the Hungarian OSD texts (thanks to István Füley).
- Updated the Russian OSD texts (thanks to Oleg Roitburd). - Updated the Russian OSD texts (thanks to Oleg Roitburd).
- Updated the Polish OSD texts (thanks to Marek Nazarko). - 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).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __CONFIG_H
@ -27,8 +27,8 @@
// The plugin API's version number: // The plugin API's version number:
#define APIVERSION "1.7.40" #define APIVERSION "1.7.41"
#define APIVERSNUM 10740 // Version * 10000 + Major * 100 + Minor #define APIVERSNUM 10741 // Version * 10000 + Major * 100 + Minor
// When loading plugins, VDR searches them by their APIVERSION, which // When loading plugins, VDR searches them by their APIVERSION, which
// may be smaller than VDRVERSION in case there have been no changes to // may be smaller than VDRVERSION in case there have been no changes to
@ -260,7 +260,7 @@ public:
int MenuScrollWrap; int MenuScrollWrap;
int MenuKeyCloses; int MenuKeyCloses;
int MarkInstantRecord; int MarkInstantRecord;
char NameInstantRecord[NAME_MAX]; char NameInstantRecord[NAME_MAX + 1];
int InstantRecordTime; int InstantRecordTime;
int LnbSLOF; int LnbSLOF;
int LnbFrequLo; int LnbFrequLo;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "recording.h"
@ -66,7 +66,7 @@
#define MAX_LINK_LEVEL 6 #define MAX_LINK_LEVEL 6
int DirectoryPathMax = PATH_MAX; int DirectoryPathMax = PATH_MAX - 1;
int DirectoryNameMax = NAME_MAX; int DirectoryNameMax = NAME_MAX;
bool DirectoryEncoding = false; bool DirectoryEncoding = false;
int InstanceId = 0; int InstanceId = 0;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __TIMERS_H
@ -39,7 +39,7 @@ private:
int stop; int stop;
int priority; int priority;
int lifetime; 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; char *aux;
const cEvent *event; const cEvent *event;
public: public:

8
vdr.c
View File

@ -22,7 +22,7 @@
* *
* The project's page is at http://www.tvdr.de * 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 <getopt.h> #include <getopt.h>
@ -281,7 +281,7 @@ int main(int argc, char *argv[])
case 'd' | 0x100: { case 'd' | 0x100: {
char *s = optarg; char *s = optarg;
int n = strtol(s, &s, 10); 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); fprintf(stderr, "vdr: invalid directory path length: %s\n", optarg);
return 2; return 2;
} }
@ -293,7 +293,7 @@ int main(int argc, char *argv[])
return 2; return 2;
} }
n = strtol(s, &s, 10); 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); fprintf(stderr, "vdr: invalid directory name length: %s\n", optarg);
return 2; return 2;
} }
@ -530,7 +530,7 @@ int main(int argc, char *argv[])
"\n", "\n",
DEFAULTCACHEDIR, DEFAULTCACHEDIR,
DEFAULTCONFDIR, DEFAULTCONFDIR,
PATH_MAX, PATH_MAX - 1,
NAME_MAX, NAME_MAX,
DEFAULTEPGDATAFILENAME, DEFAULTEPGDATAFILENAME,
MAXVIDEOFILESIZEDEFAULT, MAXVIDEOFILESIZEDEFAULT,