summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2001-07-22 14:17:15 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2001-07-22 14:17:15 +0200
commit90dc8426db01aebb862c3bb3a3e257c077223616 (patch)
treef3fb4b4167e6e964591411625bdf80bd8358b348 /config.c
parentbd48a497126ea9b96389e25872c6772f132b66d0 (diff)
downloadvdr-90dc8426db01aebb862c3bb3a3e257c077223616.tar.gz
vdr-90dc8426db01aebb862c3bb3a3e257c077223616.tar.bz2
Fixed a possible crash in parsing incorrect lines in 'channels.conf'
Diffstat (limited to 'config.c')
-rw-r--r--config.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/config.c b/config.c
index 644ca854..334719ed 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.48 2001/06/23 14:01:03 kls Exp $
+ * $Id: config.c 1.49 2001/07/22 14:15:25 kls Exp $
*/
#include "config.h"
@@ -260,13 +260,17 @@ bool cChannel::Parse(const char *s)
int fields = sscanf(s, "%a[^:]:%d:%c:%d:%d:%d:%a[^:]:%d:%d:%d", &buffer, &frequency, &polarization, &diseqc, &srate, &vpid, &apidbuf, &tpid, &ca, &pnr);
apid1 = apid2 = 0;
dpid1 = dpid2 = 0;
- char *p = strchr(apidbuf, ';');
- if (p)
- *p++ = 0;
- sscanf(apidbuf, "%d,%d", &apid1, &apid2);
- if (p)
- sscanf(p, "%d,%d", &dpid1, &dpid2);
- delete apidbuf;
+ if (apidbuf) {
+ char *p = strchr(apidbuf, ';');
+ if (p)
+ *p++ = 0;
+ sscanf(apidbuf, "%d,%d", &apid1, &apid2);
+ if (p)
+ sscanf(p, "%d,%d", &dpid1, &dpid2);
+ delete apidbuf;
+ }
+ else
+ return false;
if (fields >= 9) {
if (fields == 9) {
// allow reading of old format