[libdvbpsi-devel] dr_48.c: Fix Fix CID #17251
Jean-Paul Saman
git at videolan.org
Thu Jun 4 10:02:03 CEST 2015
libdvbpsi | branch: master | Jean-Paul Saman <jean-paul.saman at m2x.nl> | Sat May 30 15:37:17 2015 +0200| [8d3d27eb18c5639107fb92cef23ee4b2e1311215] | committer: Jean-Paul Saman
dr_48.c: Fix Fix CID #17251
> http://git.videolan.org/gitweb.cgi/libdvbpsi.git/?a=commit;h=8d3d27eb18c5639107fb92cef23ee4b2e1311215
---
src/descriptors/dr_48.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/descriptors/dr_48.c b/src/descriptors/dr_48.c
index a348dc7..760da83 100644
--- a/src/descriptors/dr_48.c
+++ b/src/descriptors/dr_48.c
@@ -116,10 +116,14 @@ dvbpsi_descriptor_t * dvbpsi_GenServiceDr(dvbpsi_service_dr_t * p_decoded,
if (p_decoded->i_service_name_length > 252)
p_decoded->i_service_name_length = 252;
+ /* FIXME: is this correct? A descriptor cannot be more then 255 bytes due to
+ * the function prototype definition */
+ uint8_t i_size = 0;
+ int i_length = 3 + p_decoded->i_service_name_length + p_decoded->i_service_provider_name_length;
+ i_size = (i_length >= UINT8_MAX) ? 255 : i_length;
+
/* Create the descriptor */
- dvbpsi_descriptor_t * p_descriptor =
- dvbpsi_NewDescriptor(0x48, 3 + p_decoded->i_service_name_length +
- p_decoded->i_service_provider_name_length, NULL);
+ dvbpsi_descriptor_t *p_descriptor = dvbpsi_NewDescriptor(0x48, i_size, NULL);
if (!p_descriptor)
return NULL;
More information about the libdvbpsi-devel
mailing list