1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-02 23:03:14 +02:00

- Added conf check for too large spamfilter regex + reason field. Reported by

Z3l3zT (#0001648).
This commit is contained in:
Bram Matthys
2004-03-14 20:16:54 +00:00
parent c35aede803
commit 2da3de60c4
2 changed files with 14 additions and 0 deletions
+2
View File
@@ -3035,3 +3035,5 @@ seen. gmtime warning still there
- Added __attribute__ stuff for ircsprintf() to catch more warnings.
- Fixed win32 compile problem. Reported by Troco (#0001644).
- Added a missing ',' to the version.c.SH script reported by docco (#0001643)
- Added conf check for too large spamfilter regex + reason field. Reported by
Z3l3zT (#0001648).
+12
View File
@@ -4878,6 +4878,7 @@ int _test_spamfilter(ConfigFile *conf, ConfigEntry *ce)
ConfigEntry *cep;
int errors = 0;
int got = 0;
char *regex = NULL, *reason = NULL;
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
{
@@ -4895,6 +4896,8 @@ int _test_spamfilter(ConfigFile *conf, ConfigEntry *ce)
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, cep->ce_varname);
errors++; continue;
}
if (!strcmp(cep->ce_varname, "reason"))
reason = cep->ce_vardata;
if (!strcmp(cep->ce_varname, "regex") || !strcmp(cep->ce_varname, "action") ||
!strcmp(cep->ce_varname, "reason") || !strcmp(cep->ce_varname, "ban-time"))
continue;
@@ -4912,6 +4915,7 @@ int _test_spamfilter(ConfigFile *conf, ConfigEntry *ce)
} else if (cep->ce_vardata) {
/* Check if it's a valid one */
char *errbuf = unreal_checkregex(cep->ce_vardata,0,0);
regex = cep->ce_vardata;
if (errbuf)
{
config_error("%s:%i: spamfilter::regex contains an invalid regex: %s",
@@ -4970,6 +4974,14 @@ int _test_spamfilter(ConfigFile *conf, ConfigEntry *ce)
}
}
if (regex && reason && (strlen(regex) + strlen(reason) > 505))
{
config_error("%s:%i: spamfilter block problem: regex + reason field are together over 505 bytes, "
"please choose a shorter regex or reason",
ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
errors++;
}
return errors;
}