Commit eeaa54cf authored by Rémi Duraffort's avatar Rémi Duraffort

Don't dereference strrchr without check (CID 185)

parent a408beac
......@@ -115,7 +115,10 @@ static int Open( vlc_object_t *p_this )
}
length_path = strlen( p_sys->p_thread->url.psz_path );
length_media_name = strlen( strrchr( p_sys->p_thread->url.psz_path, '/' ) ) - 1;
char* psz_tmp = strrchr( p_sys->p_thread->url.psz_path, '/' );
if( !psz_tmp )
goto error;
length_media_name = strlen( psz_tmp ) - 1;
p_sys->p_thread->psz_application = strndup( p_sys->p_thread->url.psz_path + 1, length_path - length_media_name - 2 );
p_sys->p_thread->psz_media = strdup( p_sys->p_thread->url.psz_path + ( length_path - length_media_name ) );
......
......@@ -129,7 +129,10 @@ static int Open( vlc_object_t *p_this )
}
length_path = strlen( p_sys->p_thread->url.psz_path );
length_media_name = strlen( strrchr( p_sys->p_thread->url.psz_path, '/' ) ) - 1;
char* psz_tmp = strrchr( p_sys->p_thread->url.psz_path, '/' );
if( !psz_tmp )
goto error;
length_media_name = strlen( psz_tmp ) - 1;
p_sys->p_thread->psz_application = strndup( p_sys->p_thread->url.psz_path + 1, length_path - length_media_name - 2 );
p_sys->p_thread->psz_media = strdup( p_sys->p_thread->url.psz_path + ( length_path - length_media_name ) );
......
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