mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 21:57:57 +03:00
Prevent using a trick to spoof another name in 1.11 and below
This commit is contained in:
parent
2f75092d8b
commit
a1e7afac76
1 changed files with 18 additions and 11 deletions
|
@ -10636,7 +10636,11 @@ void Player::EventDMMessage(Event *ev)
|
||||||
if (!Q_stricmp(client->pers.netname, "console")) {
|
if (!Q_stricmp(client->pers.netname, "console")) {
|
||||||
// Added in OPM
|
// Added in OPM
|
||||||
// Reserved name
|
// Reserved name
|
||||||
gi.Printf( "Client %d trying to send a message using a reserved name ('%s')\n", edict - g_entities, client->pers.netname);
|
gi.Printf(
|
||||||
|
"Client %d trying to send a message using a reserved name ('%s')\n",
|
||||||
|
edict - g_entities,
|
||||||
|
client->pers.netname
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10819,6 +10823,13 @@ void Player::EventDMMessage(Event *ev)
|
||||||
Q_strcat(szPrintString, sizeof(szPrintString), ":");
|
Q_strcat(szPrintString, sizeof(szPrintString), ":");
|
||||||
iStringLength = strlen(szPrintString);
|
iStringLength = strlen(szPrintString);
|
||||||
|
|
||||||
|
// Added in OPM.
|
||||||
|
// Checks for comments in string (as COM_Parse will parse them)
|
||||||
|
// This was fixed in 2.0 but make the fix compatible with older versions
|
||||||
|
if (g_protocol < protocol_e::PROTOCOL_MOHTA_MIN && strstr(client->pers.netname, "/*")) {
|
||||||
|
met_comment = true;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 2; i <= ev->NumArgs(); i++) {
|
for (i = 2; i <= ev->NumArgs(); i++) {
|
||||||
sToken = ev->GetString(i);
|
sToken = ev->GetString(i);
|
||||||
// Added in 2.40
|
// Added in 2.40
|
||||||
|
@ -10830,13 +10841,7 @@ void Player::EventDMMessage(Event *ev)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Added in OPM.
|
if (met_comment && strstr(sToken, "*/")) {
|
||||||
// Checks for comments in string (as COM_Parse will parse them)
|
|
||||||
if (strstr(sToken, "/*")) {
|
|
||||||
met_comment = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strstr(sToken, "*/") && met_comment) {
|
|
||||||
// ignore messages containing comments
|
// ignore messages containing comments
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -10849,9 +10854,11 @@ void Player::EventDMMessage(Event *ev)
|
||||||
Q_strcat(szPrintString, sizeof(szPrintString), "\n");
|
Q_strcat(szPrintString, sizeof(szPrintString), "\n");
|
||||||
|
|
||||||
// ignore names containing comments
|
// ignore names containing comments
|
||||||
if (strstr(client->pers.netname, "//")
|
if (g_protocol < protocol_e::PROTOCOL_MOHTA_MIN) {
|
||||||
|| (strstr(client->pers.netname, "/*") && strstr(client->pers.netname, "*/"))) {
|
if (strstr(client->pers.netname, "//")
|
||||||
return;
|
|| (strstr(client->pers.netname, "/*") && strstr(client->pers.netname, "*/"))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue