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;
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);
{
// arg contains whitespace, store quotes around it
com_cmdline[n++] = '\"';
- while ((n < ((int)sizeof(com_cmdline) - 1)) && com_argv[j][i])
+ while ((n < ((int)sizeof(com_cmdline) - 2)) && com_argv[j][i])
com_cmdline[n++] = com_argv[j][i++];
com_cmdline[n++] = '\"';
}
// recurse front side first because the svbsp building prefers it
if (info->relativelightorigin[plane->type] >= plane->dist)
{
- if (nodestackpos < GETLIGHTINFO_MAXNODESTACK)
+ if (nodestackpos < GETLIGHTINFO_MAXNODESTACK-1)
nodestack[nodestackpos++] = node->children[0];
nodestack[nodestackpos++] = node->children[1];
}
else
{
- if (nodestackpos < GETLIGHTINFO_MAXNODESTACK)
+ if (nodestackpos < GETLIGHTINFO_MAXNODESTACK-1)
nodestack[nodestackpos++] = node->children[1];
nodestack[nodestackpos++] = node->children[0];
}
// recurse front side first because the svbsp building prefers it
if (PlaneDist(info->relativelightorigin, plane) >= 0)
{
- if (nodestackpos < GETLIGHTINFO_MAXNODESTACK)
+ if (nodestackpos < GETLIGHTINFO_MAXNODESTACK-1)
nodestack[nodestackpos++] = node->children[0];
nodestack[nodestackpos++] = node->children[1];
}
else
{
- if (nodestackpos < GETLIGHTINFO_MAXNODESTACK)
+ if (nodestackpos < GETLIGHTINFO_MAXNODESTACK-1)
nodestack[nodestackpos++] = node->children[1];
nodestack[nodestackpos++] = node->children[0];
}
#endif
if (info->lightmins[axis] <= node->backmax)
{
- if (info->lightmaxs[axis] >= node->frontmin && nodestackpos < GETLIGHTINFO_MAXNODESTACK)
+ if (info->lightmaxs[axis] >= node->frontmin && nodestackpos < GETLIGHTINFO_MAXNODESTACK-1)
nodestack[nodestackpos++] = node->front;
nodestack[nodestackpos++] = node->back;
continue;