aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2013-05-19 19:56:09 (GMT)
committerJean-Paul Saman <jean-paul.saman@m2x.nl>2014-02-04 09:52:03 (GMT)
commitc833e5a7842425e6341ae421ec7f044a583e00c4 (patch)
tree8fa11e3896f4946bef381780f54c284974e63555
parent6f8a84a67289f4de6c1afc929c1476b2585d2ced (diff)
dr_a1: check the descriptor length before allocating p_decoded
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
-rw-r--r--src/descriptors/dr_a1.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/descriptors/dr_a1.c b/src/descriptors/dr_a1.c
index cbde4b1..b4242cc 100644
--- a/src/descriptors/dr_a1.c
+++ b/src/descriptors/dr_a1.c
@@ -59,6 +59,10 @@ dvbpsi_service_location_dr_t * dvbpsi_DecodeServiceLocationDr(
if(p_descriptor->p_decoded)
return p_descriptor->p_decoded;
+ /* Check length */
+ if((p_descriptor->i_length - 3) % 6)
+ return NULL;
+
/* Allocate memory */
p_decoded =
(dvbpsi_service_location_dr_t*)malloc(sizeof(dvbpsi_service_location_dr_t));
@@ -66,13 +70,6 @@ dvbpsi_service_location_dr_t * dvbpsi_DecodeServiceLocationDr(
memset(p_decoded, 0, sizeof(dvbpsi_service_location_dr_t));
- /* Decode data and check the length */
- if(p_descriptor->i_length < 3)
- {
- free(p_decoded);
- return NULL;
- }
-
p_descriptor->p_decoded = (void*)p_decoded;
p_decoded->i_pcr_pid = dvbpsi_get_bits(buf, 3, 13);

Privacy Policy