bug in epg.c

Message ID 200502181112.22523.wolfgang@rohdewald.de
State New
Headers

Commit Message

Wolfgang Rohdewald Feb. 18, 2005, 10:12 a.m. UTC
  this patch removes unneeded code and inhibits access to unallocated memory:
(the latter found by valgrind)
  

Patch

--- /tmp/epg.c  2005-02-18 10:44:55.000762224 +0100
+++ epg.c       2005-02-18 10:45:56.379431248 +0100
@@ -525,7 +525,7 @@ 
      if (description) {
         char *p = description;
         while (*p && *(p + 1) && *(p + 2)) {
-              if (*p == '-' && *(p + 1) == ' ' && *(p + 2) && islower(*(p - 1)) && islower(*(p + 2))) {
+              if (*p == '-' && *(p + 1) == ' ' && p != description && islower(*(p - 1)) && islower(*(p + 2))) {
                  if (!startswith(p + 2, "und ")) { // special case in German, as in "Lach- und Sachgeschichten"
                     memmove(p, p + 2, strlen(p + 2) + 1);
                     EpgBugFixStat(5, ChannelID());