1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Fixed an occasional segfault in the EIT processor

This commit is contained in:
Klaus Schmidinger 2001-02-24 12:12:58 +01:00
parent 1f6888c807
commit e18918ad06
2 changed files with 13 additions and 3 deletions

View File

@ -350,7 +350,7 @@ Video Disk Recorder Revision History
- Encrypted channels can now be selected even without knowing the PNR (however, it - Encrypted channels can now be selected even without knowing the PNR (however, it
is still necessary for the EPG info). 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 - 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 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. 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). - 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. See the INSTALL file for more information about the use of VDR with cable.
- Fixed an occasional segfault in the EIT processor.

13
eit.c
View File

@ -13,7 +13,7 @@
* the Free Software Foundation; either version 2 of the License, or * * the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. * * (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" #include "eit.h"
@ -851,7 +851,8 @@ int cEIT::ProcessEIT()
break; break;
case EIT_COMPONENT_DESCRIPTOR : 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); //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; break;
@ -910,6 +911,14 @@ int cEIT::strdvbcpy(unsigned char *dst, unsigned char *src, int max)
{ {
int a = 0; 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)) if (*src == 0x05 || (*src >= 0x20 && *src <= 0xff))
{ {
for (a = 0; a < max; a++) for (a = 0; a < max; a++)