]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_parse.c
more miscellaneous fixes from graphitemaster
[xonotic/darkplaces.git] / cl_parse.c
index 460ef2701b7f2b6fdcf9038c275e66865fa4a6d1..2828515f9da56c7f5ab0b9dd547b035c72fabd48 100644 (file)
@@ -276,7 +276,7 @@ static void CL_ParseStartSoundPacket(int largesoundindex)
 
        MSG_ReadVector(&cl_message, pos, cls.protocol);
 
-       if (sound_num >= MAX_SOUNDS)
+       if (sound_num < 0 || sound_num >= MAX_SOUNDS)
        {
                Con_Printf("CL_ParseStartSoundPacket: sound_num (%i) >= MAX_SOUNDS (%i)\n", sound_num, MAX_SOUNDS);
                return;
@@ -2305,6 +2305,13 @@ static void CL_ParseStaticSound (int large)
                sound_num = (unsigned short) MSG_ReadShort(&cl_message);
        else
                sound_num = MSG_ReadByte(&cl_message);
+
+       if (sound_num < 0 || sound_num >= MAX_SOUNDS)
+       {
+               Con_Printf("CL_ParseStaticSound: sound_num(%i) >= MAX_SOUNDS (%i)\n", sound_num, MAX_SOUNDS);
+               return;
+       }
+
        vol = MSG_ReadByte(&cl_message);
        atten = MSG_ReadByte(&cl_message);