1
0
mirror of https://github.com/anope/anope.git synced 2026-07-02 06:26:38 +02:00

Fixed a potential crash in the badwords kicker, and fixed matching BW_SINGLE with BSCaseSensitive enabled

This commit is contained in:
Adam
2011-07-23 05:01:44 -04:00
parent a11155551e
commit 30ea6365de
3 changed files with 12 additions and 26 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
Anope Version 1.8 - GIT
-----------------------
05/30 F Fixed removing vhosts on InspIRCd when m_cloaking is unloaded [#1273]
07/23 F Fixed a potential crash in the badwords kicker [ #00]
Anope Version 1.8.6
-------------------
+9 -24
View File
@@ -245,6 +245,7 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf)
mustkick = 1;
} else if (bw->type == BW_SINGLE) {
int len = strlen(bw->word);
int buf_len = strlen(nbuf);
if ((BSCaseSensitive && !strcmp(nbuf, bw->word))
|| (!BSCaseSensitive
@@ -252,23 +253,13 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf)
mustkick = 1;
/* two next if are quite odd isn't it? =) */
} else if ((strchr(nbuf, ' ') == nbuf + len)
&&
((BSCaseSensitive
&& !strcmp(nbuf, bw->word))
|| (!BSCaseSensitive
&& (stristr(nbuf, bw->word) ==
nbuf)))) {
&& ((BSCaseSensitive && strstr(nbuf, bw->word) == nbuf)
|| (!BSCaseSensitive && stristr(nbuf, bw->word) == nbuf))) {
mustkick = 1;
} else {
if ((strrchr(nbuf, ' ') ==
nbuf + strlen(nbuf) - len - 1)
&&
((BSCaseSensitive
&& (strstr(nbuf, bw->word) ==
nbuf + strlen(nbuf) - len))
|| (!BSCaseSensitive
&& (stristr(nbuf, bw->word) ==
nbuf + strlen(nbuf) - len)))) {
if (len < buf_len && (strrchr(nbuf, ' ') == nbuf + buf_len - len - 1)
&& ((BSCaseSensitive && (strstr(nbuf, bw->word) == nbuf + buf_len - len))
|| (!BSCaseSensitive && (stristr(nbuf, bw->word) == nbuf + buf_len - len)))) {
mustkick = 1;
} else {
char *wordbuf = scalloc(len + 3, 1);
@@ -313,16 +304,10 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf)
}
} else if (bw->type == BW_END) {
int len = strlen(bw->word);
int buf_len = strlen(nbuf);
if ((BSCaseSensitive
&&
(!strncmp
(nbuf + strlen(nbuf) - len, bw->word, len)))
|| (!BSCaseSensitive
&&
(!strnicmp
(nbuf + strlen(nbuf) - len, bw->word,
len)))) {
if ((BSCaseSensitive && len <= buf_len && !strncmp(nbuf + buf_len - len, bw->word, len))
|| (!BSCaseSensitive && len <= buf_len && !strnicmp(nbuf + buf_len - len, bw->word, len))) {
mustkick = 1;
} else {
char *wordbuf = scalloc(len + 2, 1);
+2 -1
View File
@@ -8,9 +8,10 @@ VERSION_MAJOR="1"
VERSION_MINOR="8"
VERSION_PATCH="7"
VERSION_EXTRA="-git"
VERSION_BUILD="3074"
VERSION_BUILD="3075"
# $Log$ # Changes since 1.8.6 Release
#Revision 3075 - Fixed a potential crash in the badwords kicker, and fixed matching BW_SINGLE with BSCaseSensitive enabled
#Revision 3074 - Bug #1273 - Fixed removing vhosts on InspIRCd when m_cloaking is unloaded