2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-01-04 02:55:50 +03:00

PVS/PAS buffer overrun fix (#282)

Fix buffer overrun in adding to fat PVS/PAS.
This commit is contained in:
LevShisterov 2016-12-20 02:06:39 +05:00 committed by theAsmodai
parent 1f96d176e7
commit 97b072a9f6

View File

@ -3979,7 +3979,11 @@ void SV_AddToFatPVS(vec_t *org, mnode_t *node)
unsigned char* EXT_FUNC SV_FatPVS(float *org)
{
#ifdef REHLDS_FIXES
fatbytes = gPVSRowBytes;
#else // REHLDS_FIXES
fatbytes = (g_psv.worldmodel->numleafs + 31) >> 3;
#endif // REHLDS_FIXES
Q_memset(fatpvs, 0, fatbytes);
SV_AddToFatPVS(org, g_psv.worldmodel->nodes);
return fatpvs;
@ -4030,7 +4034,11 @@ void SV_AddToFatPAS(vec_t *org, mnode_t *node)
unsigned char* EXT_FUNC SV_FatPAS(float *org)
{
#ifdef REHLDS_FIXES
fatpasbytes = gPVSRowBytes;
#else // REHLDS_FIXES
fatpasbytes = (g_psv.worldmodel->numleafs + 31) >> 3;
#endif // REHLDS_FIXES
Q_memset(fatpas, 0, fatpasbytes);
SV_AddToFatPAS(org, g_psv.worldmodel->nodes);
return fatpas;
@ -6775,10 +6783,10 @@ void SV_AddIP_f(void)
if (Cmd_Argc() != 3)
{
#ifdef REHLDS_FIXES
Con_Printf("Usage: addip <minutes> <ipaddress>\n\
addip <minutes> <ipaddress/CIDR>\n\
Use 0 minutes for permanent\n\
ipaddress A.B.C.D/24 is equivalent to A.B.C.0 and A.B.C\n");
Con_Printf("Usage: addip <minutes> <ipaddress>\n"
" addip <minutes> <ipaddress/CIDR>\n"
"Use 0 minutes for permanent\n"
"ipaddress A.B.C.D/24 is equivalent to A.B.C.0 and A.B.C\n");
#else // REHLDS_FIXES
Con_Printf("Usage: addip <minutes> <ipaddress>\nUse 0 minutes for permanent\n");
#endif // REHLDS_FIXES
@ -6876,9 +6884,9 @@ void SV_RemoveIP_f(void)
int argCount = Cmd_Argc();
if (argCount != 2 && argCount != 3)
{
Con_Printf("Usage: removeip <ipaddress> {removeAll}\n\
removeip <ipaddress/CIDR> {removeAll}\n\
Use removeAll to delete all ip filters which ipaddress or ipaddress/CIDR includes\n");
Con_Printf("Usage: removeip <ipaddress> {removeAll}\n"
"removeip <ipaddress/CIDR> {removeAll}\n"
"Use removeAll to delete all ip filters which ipaddress or ipaddress/CIDR includes\n");
return;
}
@ -6889,10 +6897,10 @@ Use removeAll to delete all ip filters which ipaddress or ipaddress/CIDR include
if (!StringToFilter(Cmd_Argv(1), &f))
{
#ifdef REHLDS_FIXES
Con_Printf("Invalid IP address\n\
Usage: removeip <ipaddress> {removeAll}\n\
removeip <ipaddress/CIDR> {removeAll}\n\
Use removeAll to delete all ip filters which ipaddress or ipaddress/CIDR includes\n");
Con_Printf("Invalid IP address\n"
"Usage: removeip <ipaddress> {removeAll}\n"
" removeip <ipaddress/CIDR> {removeAll}\n"
"Use removeAll to delete all ip filters which ipaddress or ipaddress/CIDR includes\n");
#endif // REHLDS_FIXES
return;