Commit cce6baf1 authored by Thomas Guillem's avatar Thomas Guillem Committed by Jean-Baptiste Kempf

dvdcss_open_stream: fix SEGFAULT due to a NULL psz_target

Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 4863c1ea
......@@ -190,7 +190,7 @@ void dvdcss_check_device ( dvdcss_t dvdcss )
#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;
}
......
......@@ -495,7 +495,7 @@ static dvdcss_t dvdcss_open_common ( const char *psz_target, void *p_stream,
/* 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';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment