[libdvbpsi-devel] dr_76.c: Fix (CID 17267) out-of-bounds write.

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:44:11 2014 +0200| [3fb4b208c78701d2ed29f1d4db79a9ae5af35c33] | committer: Jean-Paul Saman

dr_76.c: Fix (CID 17267) out-of-bounds write.

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

 src/descriptors/dr_76.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/descriptors/dr_76.c b/src/descriptors/dr_76.c
index 7089488..b32ee31 100644
--- a/src/descriptors/dr_76.c
+++ b/src/descriptors/dr_76.c
@@ -87,7 +87,9 @@ dvbpsi_content_id_dr_t *dvbpsi_DecodeContentIdDr(dvbpsi_descriptor_t *p_descript
                 entry->value.path[i] = p_descriptor->p_data[byte + i];
             }
             byte += len;
-            entry->value.path[i] = 0;
+            /* Properly terminate the string */
+            unsigned int last = (i < len) ? i : len - 1U;
+            entry->value.path[last] = 0;
         }
         else if (entry->i_location == CRID_LOCATION_CIT)
         {



More information about the libdvbpsi-devel mailing list