Commit b07d67ff authored by Rémi Duraffort's avatar Rémi Duraffort Committed by Derk-Jan Hartman

Don't dereference strrchr without check (CID 185)

(cherry picked from commit eeaa54cf)
Signed-off-by: default avatarDerk-Jan Hartman <hartman@videolan.org>
parent 44e68a74
......@@ -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