Make sure read_m3u won't read past the end of the buffer, causing a crash

This commit is contained in:
Chris Taylor 2010-11-22 20:47:46 +08:00
commit cfae937bda
2 changed files with 5 additions and 1 deletions

View file

@ -1,5 +1,9 @@
D1X-Rebirth Changelog
20101122
--------
arch/sdl/jukebox.c: Make sure read_m3u won't read past the end of the buffer, causing a crash
20101121
--------
arch/sdl/jukebox.c, include/physfsx.h, main/menu.c, misc/physfsx.c: Created function PHYSFSX_isNewPath to check wether given path has already been added to Searchpath or not; Used PHYSFSX_isNewPath for menu browsing code instead it's own implementation; Using PHYSFSX_isNewPath for Jukebox directory, too to make sure Jukebox will not accidentially remove Game content depending on user selection; Also only keep Jukebox directory added until files are stored to prevent any other file present in this path can override or add anything to the game

View file

@ -101,7 +101,7 @@ void read_m3u(void)
JukeboxSongs.max_buf = length + 1;
buf = JukeboxSongs.list_buf;
while (buf < JukeboxSongs.list_buf + length)
while (buf < JukeboxSongs.list_buf + length - 1)
{
while (*buf == 0 || *buf == 10 || *buf == 13) // find new line - support DOS, Unix and Mac line endings
buf++;