vlc | branch: master | Filip Roséen <[email protected]> | Sat Sep 3 14:25:24 2016 +0200| [f7099ec77a7762ae39a252ecadecce56e396fe1d] | committer: Thomas Guillem
playlist/art: fix potentiall null-pointer dereference filename_sanitize is not callable with a null-pointer, as such we would potentially dereference such if strdup fails. Signed-off-by: Thomas Guillem <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f7099ec77a7762ae39a252ecadecce56e396fe1d --- src/playlist/art.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/playlist/art.c b/src/playlist/art.c index 18a3764..53133e5 100644 --- a/src/playlist/art.c +++ b/src/playlist/art.c @@ -139,17 +139,19 @@ end: static char *ArtCacheName( input_item_t *p_item, const char *psz_type ) { char *psz_path = ArtCachePath( p_item ); - if( !psz_path ) - return NULL; + char *psz_ext = strdup( psz_type ? psz_type : "" ); + char *psz_filename = NULL; - ArtCacheCreateDir( psz_path ); + if( unlikely( !psz_path || !psz_ext ) ) + goto end; - char *psz_ext = strdup( psz_type ? psz_type : "" ); + ArtCacheCreateDir( psz_path ); filename_sanitize( psz_ext ); - char *psz_filename; + if( asprintf( &psz_filename, "%s" DIR_SEP "art%s", psz_path, psz_ext ) < 0 ) psz_filename = NULL; +end: free( psz_ext ); free( psz_path ); _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
