[vlc-commits] [Git][videolan/vlc][master] 2 commits: subtitles: fix use of invalid pointer

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Thu Jan 6 09:45:08 UTC 2022



Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC


Commits:
6ca0d68f by Lyndon Brown at 2022-01-06T09:20:16+00:00
subtitles: fix use of invalid pointer

should `asprintf()` fail, leaving the pointer in an undefined state, we
must ensure the null entry is written over it, rather than in the next
entry, else the calling code when looping over the list will read it.

- - - - -
3743491c by Lyndon Brown at 2022-01-06T09:20:16+00:00
subtitles: remove pointless check

psz_subdir is a copy of psz_parser, and there's a `*psz_parser != '\0'`
condition check on the loop, thus this check here is entirely pointless.

- - - - -


1 changed file:

- src/input/subtitles.c


Changes:

=====================================
src/input/subtitles.c
=====================================
@@ -188,13 +188,12 @@ static char **paths_to_list( const char *psz_dir, char *psz_path )
             while( *psz_parser == ' ' )
                 psz_parser++;
         }
-        if( *psz_subdir == '\0' )
-            continue;
 
-        if( asprintf( &subdirs[i++], "%s%s",
+        if( asprintf( &subdirs[i], "%s%s",
                   psz_subdir[0] == '.' ? psz_dir : "",
                   psz_subdir ) == -1 )
             break;
+        i++;
     }
     subdirs[i] = NULL;
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/c4edf973406e042ea1d1c74ec14987727bb137d3...3743491c607b583b055ea44590e07e2b14171514

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/c4edf973406e042ea1d1c74ec14987727bb137d3...3743491c607b583b055ea44590e07e2b14171514
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list