Commit 74207500 authored by Jean-Paul Saman's avatar Jean-Paul Saman

dr_47: add boundary checking

parent 680a990f
...@@ -65,7 +65,10 @@ dvbpsi_bouquet_name_dr_t * dvbpsi_DecodeBouquetNameDr( ...@@ -65,7 +65,10 @@ dvbpsi_bouquet_name_dr_t * dvbpsi_DecodeBouquetNameDr(
/* Decode data */ /* Decode data */
p_decoded->i_name_length = p_descriptor->i_length; p_decoded->i_name_length = p_descriptor->i_length;
if(p_decoded->i_name_length) if (p_decoded->i_name_length > 255)
p_decoded->i_name_length = 255;
if (p_decoded->i_name_length)
memcpy(p_decoded->i_char, memcpy(p_decoded->i_char,
p_descriptor->p_data, p_descriptor->p_data,
p_decoded->i_name_length); p_decoded->i_name_length);
...@@ -82,6 +85,9 @@ dvbpsi_bouquet_name_dr_t * dvbpsi_DecodeBouquetNameDr( ...@@ -82,6 +85,9 @@ dvbpsi_bouquet_name_dr_t * dvbpsi_DecodeBouquetNameDr(
dvbpsi_descriptor_t * dvbpsi_GenBouquetNameDr(dvbpsi_bouquet_name_dr_t *p_decoded, dvbpsi_descriptor_t * dvbpsi_GenBouquetNameDr(dvbpsi_bouquet_name_dr_t *p_decoded,
bool b_duplicate) bool b_duplicate)
{ {
if (p_decoded->i_name_length > 255)
p_decoded->i_name_length = 255;
/* Create the descriptor */ /* Create the descriptor */
dvbpsi_descriptor_t * p_descriptor = dvbpsi_descriptor_t * p_descriptor =
dvbpsi_NewDescriptor(0x47, p_decoded->i_name_length, NULL); dvbpsi_NewDescriptor(0x47, p_decoded->i_name_length, NULL);
......
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