Commit 21db603c authored by Jean-Paul Saman's avatar Jean-Paul Saman

descriptor: 0x41: correct max service count

parent 25707240
...@@ -39,6 +39,8 @@ ...@@ -39,6 +39,8 @@
#include "dr_41.h" #include "dr_41.h"
#define DVBPSI_SLS_DR_MAX (84)
/***************************************************************************** /*****************************************************************************
* dvbpsi_DecodeServiceListDr * dvbpsi_DecodeServiceListDr
*****************************************************************************/ *****************************************************************************/
...@@ -59,7 +61,7 @@ dvbpsi_service_list_dr_t* dvbpsi_DecodeServiceListDr( ...@@ -59,7 +61,7 @@ dvbpsi_service_list_dr_t* dvbpsi_DecodeServiceListDr(
unsigned int service_count = p_descriptor->i_length / 3; unsigned int service_count = p_descriptor->i_length / 3;
if ((p_descriptor->i_length < 1) || if ((p_descriptor->i_length < 1) ||
(p_descriptor->i_length % 3 != 0) || (p_descriptor->i_length % 3 != 0) ||
(service_count>63)) (service_count > DVBPSI_SLS_DR_MAX - 1))
return NULL; return NULL;
/* Allocate memory */ /* Allocate memory */
...@@ -91,7 +93,7 @@ dvbpsi_descriptor_t * dvbpsi_GenServiceListDr( ...@@ -91,7 +93,7 @@ dvbpsi_descriptor_t * dvbpsi_GenServiceListDr(
bool b_duplicate) bool b_duplicate)
{ {
/* Check the length */ /* Check the length */
if (p_decoded->i_service_count > 63) if (p_decoded->i_service_count > DVBPSI_SLS_DR_MAX - 1)
return NULL; return NULL;
/* Create the descriptor */ /* Create the descriptor */
......
...@@ -59,7 +59,7 @@ typedef struct dvbpsi_service_list_dr_s ...@@ -59,7 +59,7 @@ typedef struct dvbpsi_service_list_dr_s
struct { struct {
uint16_t i_service_id; /*!< service id */ uint16_t i_service_id; /*!< service id */
uint8_t i_service_type; /*!< service type */ uint8_t i_service_type; /*!< service type */
} i_service[64]; /*!< array of services */ } i_service[84]; /*!< array of services */
} dvbpsi_service_list_dr_t; } dvbpsi_service_list_dr_t;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment