]> git.sesse.net Git - vlc/commitdiff
demux: mkv: fix use after free (cid #1049107)
authorFrancois Cartegnie <fcvlcdev@free.fr>
Sat, 30 Nov 2013 20:10:51 +0000 (21:10 +0100)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Sat, 30 Nov 2013 20:34:09 +0000 (21:34 +0100)
GetMainName() can return a pointer to temporary string::

modules/demux/mkv/demux.cpp

index be20476cbe48c6cdb64018e9d34f5ed72ec62311..a0e8e89b5979ef349a5524fcf1789a18ea95ac03 100644 (file)
@@ -684,9 +684,8 @@ bool demux_sys_t::PreloadLinked()
                 // TODO use a name for each edition, let the TITLE deal with a codec name
                 if ( p_title->psz_name == NULL )
                 {
-                    const char* psz_tmp = p_ved->GetMainName().c_str();
-                    if( *psz_tmp != '\0' )
-                        p_title->psz_name = strdup( psz_tmp );
+                    if( p_ved->GetMainName().length() )
+                        p_title->psz_name = strdup( p_ved->GetMainName().c_str() );
                     else
                     {
                         /* Check in tags if the edition has a name */