mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-06-12 17:14:46 +02:00
Enforce MAXBANLEN (which is MODEBUFLEN) at some more places.
This shouldn't be needed except for some corner cases, like if some third party module does not limit their stuff properly, in S2S or if channeldb contains some weird long entry or something.
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
created or just tested for existance */
|
||||
|
||||
#define MODEBUFLEN 200
|
||||
#define MAXBANLEN 200 /* Maximum length of a complete ban */
|
||||
|
||||
#define ChannelExists(n) (find_channel(n))
|
||||
|
||||
|
||||
@@ -877,7 +877,11 @@ const char *clean_ban_mask(const char *mask_in, int what, ExtbanType ban_type, C
|
||||
* allow it too (so you don't get "unremovable" extbans).
|
||||
*/
|
||||
if (!MyUser(client) || (what == MODE_DEL))
|
||||
{
|
||||
if ((what == MODE_ADD) && (strlen(mask) > MAXBANLEN))
|
||||
mask[MAXBANLEN] = '\0';
|
||||
return mask; /* allow it */
|
||||
}
|
||||
return NULL; /* reject */
|
||||
}
|
||||
|
||||
@@ -895,6 +899,8 @@ const char *clean_ban_mask(const char *mask_in, int what, ExtbanType ban_type, C
|
||||
ret = extban->conv_param(b, extban);
|
||||
ret = prefix_with_extban(ret, b, extban, retbuf, sizeof(retbuf));
|
||||
safe_free(b);
|
||||
if (ret && strlen(ret) > MAXBANLEN)
|
||||
retbuf[MAXBANLEN] = '\0';
|
||||
return ret;
|
||||
}
|
||||
/* else, do some basic sanity checks and cut it off at 80 bytes */
|
||||
|
||||
Reference in New Issue
Block a user