[libdvdcss-devel] [PATCH] Fix buffer overflow when region mask is 0x0

Pierre Lamot pierre at videolabs.io
Thu Mar 1 10:41:45 CET 2018


---
 src/css.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/css.c b/src/css.c
index f7e5a88..55cb8df 100644
--- a/src/css.c
+++ b/src/css.c
@@ -101,7 +101,7 @@ static int  dvdcss_titlekey ( dvdcss_t, int, dvd_key );
 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 @@ int dvdcss_test( dvdcss_t dvdcss )
         default: psz_type = "unknown status"; break;
     }
 
+    *p_region = '\0';
     for( i_region = 0; i_region < 8; i_region++ )
     {
         if( !( i_mask & ( 1 << i_region ) ) )
-- 
2.14.1



More information about the libdvdcss-devel mailing list