From 812ab9018c7be7feb901eface4c6431b483ca9ec Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 6 Nov 2005 18:00:00 +0100 Subject: =?UTF-8?q?Version=201.3.36=20-=20Fixed=20a=20NULL=20pointer=20acc?= =?UTF-8?q?ess=20with=20the=20cUnbufferedFile=20when=20a=20replay=20sessio?= =?UTF-8?q?n=20runs=20=20=20all=20the=20way=20until=20the=20end=20of=20the?= =?UTF-8?q?=20recording=20(thanks=20to=20Joachim=20Wilke).=20-=20A=20menu?= =?UTF-8?q?=20is=20no=20longer=20automatically=20closed=20when=20a=20repla?= =?UTF-8?q?y=20ends=20(reported=20by=20=20=20Marko=20M=C3=A4kel=C3=A4).=20?= =?UTF-8?q?-=20Removed=20'\n'=20from=20several=20syslog()=20calls=20(repor?= =?UTF-8?q?ted=20by=20Sascha=20Volkenandt).=20-=20Fixed=20missing=20'&'=20?= =?UTF-8?q?in=20the=20SetAreas()=20example=20in=20PLUGINS.html=20(reported?= =?UTF-8?q?=20by=20=20=20Sascha=20Volkenandt).=20-=20Fixed=20a=20memory=20?= =?UTF-8?q?leak=20in=20cString::operator=3D()=20(reported=20by=20Sascha=20?= =?UTF-8?q?Volkenandt).=20-=20Updated=20the=20Dutch=20OSD=20texts=20(thank?= =?UTF-8?q?s=20to=20Maarten=20Wisse).=20-=20cReadLine=20now=20dynamically?= =?UTF-8?q?=20allocates=20its=20buffer,=20so=20that=20it=20can=20handle=20?= =?UTF-8?q?lines=20=20=20of=20any=20length.=20-=20Changed=20cConfig::Load(?= =?UTF-8?q?)=20to=20use=20cReadLine=20instead=20of=20a=20fixed=20buffer=20?= =?UTF-8?q?(thanks=20=20=20to=20Andreas=20Mair=20for=20reporting=20a=20pro?= =?UTF-8?q?blem=20with=20extremely=20long=20summary=20fields=20=20=20in=20?= =?UTF-8?q?timers).=20-=20cSVDRP=20now=20dynamically=20allocates=20its=20c?= =?UTF-8?q?ommand=20buffer=20in=20order=20to=20handle=20=20=20commands=20o?= =?UTF-8?q?f=20any=20length.=20The=20MAXPARSEBUFFER=20macro=20is=20now=20o?= =?UTF-8?q?bsolete=20and=20has=20=20=20been=20removed.=20If=20a=20plugin?= =?UTF-8?q?=20has=20used=20that=20macro,=20it=20should=20either=20define?= =?UTF-8?q?=20=20=20a=20buffer=20size=20of=20its=20own,=20or=20use=20cRead?= =?UTF-8?q?Line=20when=20reading=20files.=20-=20Fixed=20a=20race=20conditi?= =?UTF-8?q?on=20in=20the=20SPU=20decoder=20(thanks=20to=20Marco=20Schl?= =?UTF-8?q?=C3=BC=C3=9Fler).=20-=20The=20EPG=20scan=20no=20longer=20distur?= =?UTF-8?q?bs=20players=20that=20have=20also=20set=20live=20PIDs=20=20=20(?= =?UTF-8?q?reported=20by=20Stefan=20Huelswitt).=20-=20Fixed=20setting=20th?= =?UTF-8?q?e=20help=20key=20display=20in=20the=20Recordings=20menu=20in=20?= =?UTF-8?q?case=20of=20several=20=20=20layers=20of=20subdirectories.=20-?= =?UTF-8?q?=20Removed=20EPG=20bugfix=20#0,=20because=20it=20removed=20actu?= =?UTF-8?q?ally=20important=20data.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- svdrp.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'svdrp.c') diff --git a/svdrp.c b/svdrp.c index cc5df70..8e09d41 100644 --- a/svdrp.c +++ b/svdrp.c @@ -10,7 +10,7 @@ * and interact with the Video Disk Recorder - or write a full featured * graphical interface that sits on top of an SVDRP connection. * - * $Id: svdrp.c 1.82 2005/09/25 10:36:59 kls Exp $ + * $Id: svdrp.c 1.83 2005/11/05 11:21:38 kls Exp $ */ #include "svdrp.h" @@ -361,6 +361,8 @@ cSVDRP::cSVDRP(int Port) { PUTEhandler = NULL; numChars = 0; + length = BUFSIZ; + cmdLine = MALLOC(char, length); message = NULL; lastActivity = 0; isyslog("SVDRP listening on port %d", Port); @@ -370,6 +372,7 @@ cSVDRP::~cSVDRP() { Close(); free(message); + free(cmdLine); } void cSVDRP::Close(bool Timeout) @@ -1442,6 +1445,11 @@ bool cSVDRP::Process(void) // showtime! Execute(cmdLine); numChars = 0; + if (length > BUFSIZ) { + free(cmdLine); // let's not tie up too much memory + length = BUFSIZ; + cmdLine = MALLOC(char, length); + } } else if (c == 0x04 && numChars == 0) { // end of file (only at beginning of line) @@ -1455,15 +1463,14 @@ bool cSVDRP::Process(void) else if (c <= 0x03 || c == 0x0D) { // ignore control characters } - else if (numChars < sizeof(cmdLine) - 1) { + else { + if (numChars >= length - 1) { + length += BUFSIZ; + cmdLine = (char *)realloc(cmdLine, length); + } cmdLine[numChars++] = c; cmdLine[numChars] = 0; } - else { - Reply(501, "Command line too long"); - esyslog("SVDRP: command line too long: '%s'", cmdLine); - numChars = 0; - } lastActivity = time(NULL); } else if (r < 0) { -- cgit v1.2.3