shithub: libdvdcss

Download patch

ref: cce6baf1edf30fd39650eea94e752f5be515feb9
parent: 4863c1ea386041bbf244f4d0a41aea063a810a2a
author: Thomas Guillem <[email protected]>
date: Wed Jan 28 11:29:39 EST 2015

dvdcss_open_stream: fix SEGFAULT due to a NULL psz_target

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

--- a/src/device.c
+++ b/src/device.c
@@ -190,7 +190,7 @@
 #endif
 
     /* If the device name is non-NULL or stream is set, return. */
-    if( dvdcss->psz_device[0] || dvdcss->p_stream )
+    if( (dvdcss->psz_device && dvdcss->psz_device[0]) || dvdcss->p_stream )
     {
         return;
     }
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -495,7 +495,7 @@
     /* Initialize structure with default values. */
     dvdcss->i_pos = 0;
     dvdcss->p_titles = NULL;
-    dvdcss->psz_device = strdup( psz_target );
+    dvdcss->psz_device = psz_target ? strdup( psz_target ) : NULL;
     dvdcss->psz_error = "no error";
     dvdcss->i_method = DVDCSS_METHOD_KEY;
     dvdcss->psz_cachefile[0] = '\0';