From 367b3f8c7d128f6e7f48d2304440f08577ab0024 Mon Sep 17 00:00:00 2001
From: Klaus Schmidinger <vdr@tvdr.de>
Date: Sat, 6 Apr 2002 14:02:41 +0200
Subject: Fixed a possible hangup when reading a broken epg.data file

---
 CONTRIBUTORS |  1 +
 HISTORY      |  2 ++
 eit.c        | 10 +++++-----
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index b97cbcf2..e5157e04 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -88,6 +88,7 @@ Benjamin Reichardt <reichard@math.uni-goettingen.de>
 Henning Holtschneider <hh@holtschneider.com>
  for patching 'runvdr' to check whether the driver is already loaded
  for reporting a bug in parsing group separators in channels.conf
+ for pointing out a possible hangup when reading a broken epg.data file
 
 Paulo Lopes <pmml@netvita.pt>
  for translating OSD texts to the Portugese language
diff --git a/HISTORY b/HISTORY
index 5d2d89b5..db6f505e 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1184,3 +1184,5 @@ Video Disk Recorder Revision History
   (thanks to Thilo Wunderlich for reporting this one).
 - Now the EPG scan skips channels that have their 'Ca' parameter explicitly set
   to an other DVB card (suggested by Sergei Haller).
+- Fixed a possible hangup when reading a broken epg.data file (thanks to Henning
+  Holtschneider for pointing this one out).
diff --git a/eit.c b/eit.c
index af4d3394..b27fbc7a 100644
--- a/eit.c
+++ b/eit.c
@@ -16,7 +16,7 @@
  *   the Free Software Foundation; either version 2 of the License, or     *
  *   (at your option) any later version.                                   *
  *                                                                         *
- * $Id: eit.c 1.43 2002/04/06 11:42:47 kls Exp $
+ * $Id: eit.c 1.44 2002/04/06 13:58:59 kls Exp $
  ***************************************************************************/
 
 #include "eit.h"
@@ -390,12 +390,12 @@ bool cEventInfo::Read(FILE *f, cSchedule *Schedule)
              case 'e': pEvent = NULL;
                        break;
              case 'c': // to keep things simple we react on 'c' here
-                       return false;
+                       return true;
              default:  esyslog(LOG_ERR, "ERROR: unexpected tag while reading EPG data: %s", s);
                        return false;
              }
            }
-     return true;
+     esyslog(LOG_ERR, "ERROR: unexpected end of file while reading EPG data");
      }
   return false;
 }
@@ -754,8 +754,8 @@ bool cSchedule::Read(FILE *f, cSchedules *Schedules)
               if (1 == sscanf(s + 1, "%u", &uServiceID)) {
                  cSchedule *p = (cSchedule *)Schedules->SetCurrentServiceID(uServiceID);
                  if (p) {
-                    while (cEventInfo::Read(f, p))
-                          ; // loop stops after having read the closing 'c'
+                    if (!cEventInfo::Read(f, p))
+                       return false;
                     }
                  }
               }
-- 
cgit v1.2.3