Fix incorrect read length in D1 piggy_read_sounds

Reported-by: Kreeblah <https://github.com/dxx-rebirth/dxx-rebirth/issues/542>
Fixes: faf37e3c14 ("Always allocate D2-sized sound array")
This commit is contained in:
Kp 2020-09-11 03:08:03 +00:00
parent 969caa8c0c
commit 9c5f7b1248

View file

@ -1189,7 +1189,10 @@ void piggy_read_sounds(int pc_shareware)
// hack for Mac Demo
if (auto array = PHYSFSX_openReadBuffered(soundfile))
{
if (PHYSFS_read(array, Sounds, Sounds.size(), 1) != 1) // make the 'Sounds' index array match with the sounds we're about to read in
/* Sounds.size() is the D2-compatible size, but this
* statement must read a D1 length, so use MAX_SOUNDS.
*/
if (PHYSFS_read(array, Sounds, MAX_SOUNDS, 1) != 1) // make the 'Sounds' index array match with the sounds we're about to read in
{
con_printf(CON_URGENT,"Warning: Can't read Sounds/sounds.array: %s", PHYSFS_getLastError());
return;