summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2011-07-31 13:48:49 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2011-07-31 13:48:49 +0200
commit4278458e69cbc785975bcd5f27c4ce98ac1381b8 (patch)
treef33fb4b4ada0b93fe4d37de05a08728569608f76
parent404124eca463c5ba8ce76b1b3ca4e9454eeee7d4 (diff)
downloadvdr-4278458e69cbc785975bcd5f27c4ce98ac1381b8.tar.gz
vdr-4278458e69cbc785975bcd5f27c4ce98ac1381b8.tar.bz2
Now checking Setup.InitialChannel for NULL before using it
-rw-r--r--CONTRIBUTORS1
-rw-r--r--HISTORY2
-rw-r--r--vdr.c14
3 files changed, 11 insertions, 6 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 871f6bf9..7e3aeb2d 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -2223,6 +2223,7 @@ Christoph Haubrich <christoph1.haubrich@arcor.de>
for suggesting to add a note to cTsToPes about all TS packets having to belong to
the same PID
for adding HD stream content identifiers to vdr.5
+ for reporting that Setup.InitialChannel was dereferenced without checking for NULL
Pekka Mauno <pekka.mauno@iki.fi>
for fixing cSchedule::GetFollowingEvent() in case there is currently no present
diff --git a/HISTORY b/HISTORY
index f5780e8e..1c9c0240 100644
--- a/HISTORY
+++ b/HISTORY
@@ -6655,3 +6655,5 @@ Video Disk Recorder Revision History
- Added some missing 'const' to tChannelID (reported by Sundararaj Reel).
- The isnumber() function now checks the given pointer for NULL (thanks to Holger
Dengler).
+- Now checking Setup.InitialChannel for NULL before using it (reported by
+ Christoph Haubrich).
diff --git a/vdr.c b/vdr.c
index ad86f5a8..83793756 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.21 2011/06/13 14:40:12 kls Exp $
+ * $Id: vdr.c 2.22 2011/07/31 13:42:53 kls Exp $
*/
#include <getopt.h>
@@ -704,12 +704,14 @@ int main(int argc, char *argv[])
if (!cDevice::WaitForAllDevicesReady(DEVICEREADYTIMEOUT))
dsyslog("not all devices ready after %d seconds", DEVICEREADYTIMEOUT);
- if (isnumber(Setup.InitialChannel)) { // for compatibility with old setup.conf files
- if (cChannel *Channel = Channels.GetByNumber(atoi(Setup.InitialChannel)))
- Setup.InitialChannel = Channel->GetChannelID().ToString();
+ if (*Setup.InitialChannel) {
+ if (isnumber(Setup.InitialChannel)) { // for compatibility with old setup.conf files
+ if (cChannel *Channel = Channels.GetByNumber(atoi(Setup.InitialChannel)))
+ Setup.InitialChannel = Channel->GetChannelID().ToString();
+ }
+ if (cChannel *Channel = Channels.GetByChannelID(tChannelID::FromString(Setup.InitialChannel)))
+ Setup.CurrentChannel = Channel->Number();
}
- if (cChannel *Channel = Channels.GetByChannelID(tChannelID::FromString(Setup.InitialChannel)))
- Setup.CurrentChannel = Channel->Number();
if (Setup.InitialVolume >= 0)
Setup.CurrentVolume = Setup.InitialVolume;
Channels.SwitchTo(Setup.CurrentChannel);