shithub: libdvdcss

Download patch

ref: eab9626405faad756ef83f150505467f20bc931f
parent: d4383c541a5a781001b718ad4e01917c63c9f2a4
author: Pierre Lamot <[email protected]>
date: Thu Mar 1 05:41:45 EST 2018

Fix buffer overflow when region mask is 0x0

Signed-off-by: Jean-Baptiste Kempf <[email protected]>

--- a/src/css.c
+++ b/src/css.c
@@ -101,7 +101,7 @@
 int dvdcss_test( dvdcss_t dvdcss )
 {
     const char *psz_type, *psz_rpc;
-    char psz_region[16];
+    char psz_region[17];
     char *p_region = psz_region;
     int i_ret, i_copyright, i_type, i_mask, i_rpc, i_region;
 
@@ -160,6 +160,7 @@
         default: psz_type = "unknown status"; break;
     }
 
+    *p_region = '\0';
     for( i_region = 0; i_region < 8; i_region++ )
     {
         if( !( i_mask & ( 1 << i_region ) ) )