Fix a buffer overflow in AL_AddLoopSounds

This fixes a crash in mine4.bsp and most likely some other problems.
The bug was reported by "mxmvasilyev0 [at] gmail [dot] com" and tracked
as Github issue #1.
This commit is contained in:
Yamagi Burmeister 2012-05-12 14:42:15 +02:00
parent 6ee203d70c
commit 4a414b588e

View file

@ -288,7 +288,7 @@ static channel_t *AL_FindLoopingSound( int entnum, sfx_t *sfx ) {
static void AL_AddLoopSounds( void ) { static void AL_AddLoopSounds( void ) {
int i; int i;
int sounds[64]; // 64 is MAX_PACKET_ENTITIES in YQ2 (there's no define for it, though :/) int sounds[MAX_EDICTS];
channel_t *ch; channel_t *ch;
sfx_t *sfx; sfx_t *sfx;
sfxcache_t *sc; sfxcache_t *sc;
@ -395,7 +395,7 @@ void AL_Update( void ) {
Com_Printf ("%.1f %s\n", ch->master_vol, ch->sfx->name); Com_Printf ("%.1f %s\n", ch->master_vol, ch->sfx->name);
} }
AL_Spatialize(ch); // respatialize channel AL_Spatialize(ch); // respatialize channel
} }
s_framecount++; s_framecount++;