core/playlists/system: Check that we read a valid playlist name

Otherwise we could crash when we try to access an out of bounds area of
the playlist array.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2016-07-28 08:55:53 -04:00
parent 3098282382
commit 1d1e41916a
1 changed files with 2 additions and 1 deletions

View File

@ -53,7 +53,8 @@ static bool __sys_pl_load()
file_readf(&sys_file, "%*u %m[^\n]\n", &name);
plist = __sys_pl_convert(name);
queue_load_tracks(&sys_playlists[plist], &sys_file);
if (plist < SYS_PL_NUM_PLAYLISTS)
queue_load_tracks(&sys_playlists[plist], &sys_file);
g_free(name);
}