descriptors/dr_50.c: Dereference null pointer (CID 17264)

[email protected] (Jean-Paul Saman) Wed, 16 Apr 2014 15:53:32 +0200 (CEST)
Newsgroups gmane.comp.video.videolan.libdvbpsi.devel
Message-ID <[email protected]>
libdvbpsi | branch: master | Jean-Paul Saman <[email protected]> | Fri Apr 11 15:42:04 2014 +0200| [2e5781e4f477ce22ebd597c3f9adbbf9579b028f] | committer: Jean-Paul Saman

descriptors/dr_50.c: Dereference null pointer (CID 17264)

The bug occurs due to a missing check for allocation failure of p_decoded->i_text.
Instead p_decoded is checked again.

> http://git.videolan.org/gitweb.cgi/libdvbpsi.git/?a=commit;h=2e5781e4f477ce22ebd597c3f9adbbf9579b028f
---

 src/descriptors/dr_50.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/descriptors/dr_50.c b/src/descriptors/dr_50.c
index f6321f9..a2e491c 100644
--- a/src/descriptors/dr_50.c
+++ b/src/descriptors/dr_50.c
@@ -71,7 +71,7 @@ dvbpsi_component_dr_t* dvbpsi_DecodeComponentDr(dvbpsi_descriptor_t * p_descript
     {
     	p_decoded->i_text_length = p_descriptor->i_length - 6;
     	p_decoded->i_text = calloc(p_decoded->i_text_length - 6, sizeof(uint8_t));
-        if (!p_decoded)
+        if (!p_decoded->i_text)
         {
         	free(p_decoded);
             return NULL;

_______________________________________________
libdvbpsi-devel mailing list
[email protected]
https://mailman.videolan.org/listinfo/libdvbpsi-devel