2
0
mirror of https://github.com/rehlds/rehlds.git synced 2024-12-29 08:05:50 +03:00

Merge pull request #1 from theAsmodai/master

Some bugfixes and improvements
This commit is contained in:
dreamstalker 2015-05-06 03:08:01 +04:00
commit 1d6b7f1a02
3 changed files with 25 additions and 0 deletions

View File

@ -503,6 +503,12 @@ void SV_DropClient(client_t *cl, qboolean crash, const char *fmt, ...)
g_psvs.stats.cumulative_sessiontime = g_psvs.stats.cumulative_sessiontime + connection_time;
}
#ifdef REHLDS_FIXES
// prevent message reading after disconnect
if (cl == host_client)
msg_readcount = net_message.cursize;
#endif // REHLDS_FIXES
Netchan_Clear(&cl->netchan);
Steam_NotifyClientDisconnect(cl);

View File

@ -272,10 +272,13 @@ qboolean Info_IsKeyImportant(const char *key)
return true;
if (!Q_strcmp(key, "cl_lc"))
return true;
#ifndef REHLDS_FIXES
// keys starts from '*' already checked
if (!Q_strcmp(key, "*hltv"))
return true;
if (!Q_strcmp(key, "*sid"))
return true;
#endif
return false;
}

View File

@ -2198,7 +2198,11 @@ void SV_ConnectClient_internal(void)
client_t *client;
netadr_t adr;
int nClientSlot;
#ifdef REHLDS_FIXES
char userinfo[MAX_INFO_STRING];
#else
char userinfo[1024];
#endif
char protinfo[1024];
char cdkey[64];
const char *s;
@ -2246,7 +2250,12 @@ void SV_ConnectClient_internal(void)
}
s = Cmd_Argv(4);
#ifdef REHLDS_FIXES
// truncate to 255 before sanity checks
if (Q_strlen(s) > MAX_INFO_STRING - 1 || !Info_IsValid(s))
#else
if (Q_strlen(s) > 256 || !Info_IsValid(s))
#endif
{
SV_RejectConnection(&adr, "Invalid userinfo in connect command\n");
return;
@ -4442,7 +4451,14 @@ qboolean SV_SendClientDatagram(client_t *client)
}
else
{
#ifdef REHLDS_FIXES
if (msg.cursize + client->datagram.cursize > msg.maxsize)
Con_DPrintf("Warning: Ignoring unreliable datagram for %s, would overflow on msg\n", client->name);
else
SZ_Write(&msg, client->datagram.data, client->datagram.cursize);
#else
SZ_Write(&msg, client->datagram.data, client->datagram.cursize);
#endif
}
SZ_Clear(&client->datagram);