[libdvbpsi-devel] examples/get_pcr_pid.c: Fix out-of-bounds write (CID: 17266)

Jean-Paul Saman git at videolan.org
Wed Apr 16 15:53:31 CEST 2014


libdvbpsi | branch: master | Jean-Paul Saman <jpsaman at videolan.org> | Fri Apr 11 14:54:35 2014 +0200| [8d6c1cb30648640d176b3d8d33dbce75decffffa] | committer: Jean-Paul Saman

examples/get_pcr_pid.c: Fix out-of-bounds write (CID: 17266)

The value of i_nb_programs could exceed the MAX_PROGRAMS limit and thus
produce a buffer overrun.

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

 examples/get_pcr_pid.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/get_pcr_pid.c b/examples/get_pcr_pid.c
index bf43e99..322bb72 100644
--- a/examples/get_pcr_pid.c
+++ b/examples/get_pcr_pid.c
@@ -116,7 +116,7 @@ static void PATCallback( void *_unused, dvbpsi_pat_t *p_pat )
         return;
     }
 
-    for( p_program = p_pat->p_first_program; p_program != NULL;
+    for( p_program = p_pat->p_first_program; p_program != NULL && i_nb_programs < MAX_PROGRAMS;
          p_program = p_program->p_next )
     {
         if( p_program->i_number != 0



More information about the libdvbpsi-devel mailing list