1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-12 15:34:47 +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:
Bram Matthys
2026-02-22 12:35:07 +01:00
parent ac86029a61
commit d38a106879
2 changed files with 7 additions and 0 deletions
+1
View File
@@ -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))
+6
View File
@@ -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 */