mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-10 07:12:03 +00:00
Enforce MAX_REASONLENGTH when reading ban.txt.
This commit is contained in:
parent
8addea0d45
commit
cd6b1b2cd9
1 changed files with 16 additions and 3 deletions
|
@ -2761,9 +2761,9 @@ static void Command_ClearBans(void)
|
|||
void D_LoadBan(boolean warning)
|
||||
{
|
||||
FILE *f;
|
||||
size_t i;
|
||||
const char *address, *mask;
|
||||
const char *username, *reason;
|
||||
size_t i, j;
|
||||
char *address, *mask;
|
||||
char *username, *reason;
|
||||
time_t unbanTime = NO_BAN_TIME;
|
||||
char buffer[MAX_WADPATH];
|
||||
boolean banmode = 0;
|
||||
|
@ -2817,6 +2817,19 @@ void D_LoadBan(boolean warning)
|
|||
reason = strtok(NULL, "\"\r\n"); // go until next "
|
||||
}
|
||||
|
||||
// Enforce MAX_REASONLENGTH.
|
||||
if (reason)
|
||||
{
|
||||
j = 0;
|
||||
while (reason[j] != '\0')
|
||||
{
|
||||
if ((j++) < MAX_REASONLENGTH)
|
||||
continue;
|
||||
reason[j] = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
I_SetBanAddress(address, mask);
|
||||
|
||||
if (I_SetUnbanTime)
|
||||
|
|
Loading…
Reference in a new issue