summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2001-02-24 12:12:58 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2001-02-24 12:12:58 +0100
commite18918ad06c0b3ba78e4eb0ec136a3911dff9633 (patch)
tree15aea2a99bec946bae6d08e1276918552f2f6e6f
parent1f6888c8077689d530741cac5c7aeb4874ff1c04 (diff)
downloadvdr-e18918ad06c0b3ba78e4eb0ec136a3911dff9633.tar.gz
vdr-e18918ad06c0b3ba78e4eb0ec136a3911dff9633.tar.bz2
Fixed an occasional segfault in the EIT processor
-rw-r--r--HISTORY3
-rw-r--r--eit.c13
2 files changed, 13 insertions, 3 deletions
diff --git a/HISTORY b/HISTORY
index e6fd496b..883e46a1 100644
--- a/HISTORY
+++ b/HISTORY
@@ -350,7 +350,7 @@ Video Disk Recorder Revision History
- Encrypted channels can now be selected even without knowing the PNR (however, it
is still necessary for the EPG info).
-2001-02-19: Version 0.71
+2001-02-24: Version 0.71
- Fixed 'Transfer Mode' in cases where a non-primary interface was switched to
a channel that only the primary interface can receive (which could happen in
@@ -401,3 +401,4 @@ Video Disk Recorder Revision History
in file names (VFAT can't handle them). Do 'make VFAT=1' to enable this.
- Support for DVB-C (thanks to Hans-Peter Raschke and Peter Hofmann).
See the INSTALL file for more information about the use of VDR with cable.
+- Fixed an occasional segfault in the EIT processor.
diff --git a/eit.c b/eit.c
index e7c60c16..08588b06 100644
--- a/eit.c
+++ b/eit.c
@@ -13,7 +13,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
- * $Id: eit.c 1.11 2000/12/03 15:33:37 kls Exp $
+ * $Id: eit.c 1.12 2001/02/24 12:12:58 kls Exp $
***************************************************************************/
#include "eit.h"
@@ -851,7 +851,8 @@ int cEIT::ProcessEIT()
break;
case EIT_COMPONENT_DESCRIPTOR :
- strdvbcpy(tmp, &buffer[bufact + 8], buffer[bufact + 1] - 6);
+ if (buffer[bufact + 1] > 6) // kls 2001-02-24: otherwise strncpy() causes a segfault in strdvbcpy()
+ strdvbcpy(tmp, &buffer[bufact + 8], buffer[bufact + 1] - 6);
//dsyslog(LOG_INFO, "Found EIT_COMPONENT_DESCRIPTOR %c%c%c 0x%02x/0x%02x/0x%02x '%s'\n", buffer[bufact + 5], buffer[bufact + 6], buffer[bufact + 7], buffer[2], buffer[3], buffer[4], tmp);
break;
@@ -910,6 +911,14 @@ int cEIT::strdvbcpy(unsigned char *dst, unsigned char *src, int max)
{
int a = 0;
+ // kls 2001-02-24: if we come in with negative values, the caller must
+ // have done something wrong and the strncpy() below will cause a segfault
+ if (max <= 0)
+ {
+ *dst = 0;
+ return 0;
+ }
+
if (*src == 0x05 || (*src >= 0x20 && *src <= 0xff))
{
for (a = 0; a < max; a++)