Fix some bugs.

This commit is contained in:
Shpoike 2023-02-20 08:53:25 +00:00
parent 832ee6beef
commit 2c8c9b615f
4 changed files with 11 additions and 2 deletions

View File

@ -3534,7 +3534,7 @@ static void SCTP_Decode(sctp_t *sctp, struct icestate_s *peer, ftenet_connection
while ((qbyte*)(c+1) <= msgend) while ((qbyte*)(c+1) <= msgend)
{ {
clen = BigShort(c->length); clen = BigShort(c->length);
if ((qbyte*)c + clen > msgend) if ((qbyte*)c + clen > msgend || clen < sizeof(*c))
break; //corrupt break; //corrupt
safeswitch(c->type) safeswitch(c->type)
{ {
@ -3587,7 +3587,7 @@ static void SCTP_Decode(sctp_t *sctp, struct icestate_s *peer, ftenet_connection
if (adv > sctp->i.htsn) //weird maths in case it wraps. if (adv > sctp->i.htsn) //weird maths in case it wraps.
sctp->i.htsn = adv; sctp->i.htsn = adv;
sctp->i.r.tsn++; sctp->i.r.tsn++;
if (sctp->i.r.size + clen-sizeof(*dc) > sizeof(sctp->i.r.buf)) if (sctp->i.r.size + dlen > sizeof(sctp->i.r.buf))
{ {
if (net_ice_debug.ival >= 2) if (net_ice_debug.ival >= 2)
Con_Printf(S_COLOR_GRAY"[%s]: SCTP: Oversized\n", peer->friendlyname); Con_Printf(S_COLOR_GRAY"[%s]: SCTP: Oversized\n", peer->friendlyname);

View File

@ -5826,11 +5826,13 @@ QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail)
//swap the class out for the appropriate function type... //swap the class out for the appropriate function type...
newparm = QCC_PR_GenFunctionType(type_void, basetype->params, basetype->num_parms); newparm = QCC_PR_GenFunctionType(type_void, basetype->params, basetype->num_parms);
parmname = classname; parmname = classname;
arraysize = 0;
} }
else if (!flag_qcfuncs && basetype == newt && QCC_PR_CheckToken("(")) else if (!flag_qcfuncs && basetype == newt && QCC_PR_CheckToken("("))
{ {
newparm = QCC_PR_ParseFunctionType(false, type_void); newparm = QCC_PR_ParseFunctionType(false, type_void);
parmname = classname; parmname = classname;
arraysize = 0;
} }
else else
{ {

View File

@ -835,6 +835,7 @@ void NPP_NQFlush(void)
break; break;
case svcfte_cgamepacket: case svcfte_cgamepacket:
requireextension = PEXT_CSQC;
if (sv_csqcdebug.ival || writedest != &sv.multicast) if (sv_csqcdebug.ival || writedest != &sv.multicast)
{ {
if (writedest != &sv.multicast) if (writedest != &sv.multicast)
@ -1919,6 +1920,7 @@ void NPP_QWFlush(void)
break; break;
case svcfte_cgamepacket: case svcfte_cgamepacket:
requireextension = PEXT_CSQC;
if (sv_csqcdebug.ival || writedest != &sv.nqmulticast) if (sv_csqcdebug.ival || writedest != &sv.nqmulticast)
{ {
if (writedest != &sv.nqmulticast) if (writedest != &sv.nqmulticast)

View File

@ -3268,6 +3268,11 @@ void SV_PrecacheList_f(void)
{ {
unsigned int i; unsigned int i;
char *group = Cmd_Argv(1); char *group = Cmd_Argv(1);
if (sv.state != ss_active)
{
Con_Printf("Server is not active.\n");
return;
}
#ifdef HAVE_LEGACY #ifdef HAVE_LEGACY
if (!*group || !strncmp(group, "vwep", 4)) if (!*group || !strncmp(group, "vwep", 4))
{ {