From 6933e1839b50b0eaf6f381be0139611e1dca3e91 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Sun, 22 Feb 2026 12:42:44 +0100 Subject: [PATCH] Update extban_conv_param_nuh_or_extban() to use MAXBANLEN instead of arbitrary 256 and such. Also makes it so other people reading this code will understand better that MAXBANLEN is the real limit here and not 256 (which is never reached because the cut off already happens at 200). --- src/api-extban.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/api-extban.c b/src/api-extban.c index 058418c21..e6f85ec14 100644 --- a/src/api-extban.c +++ b/src/api-extban.c @@ -384,13 +384,12 @@ const char *extban_conv_param_nuh(BanContext *b, Extban *extban) */ const char *extban_conv_param_nuh_or_extban(BanContext *b, Extban *self_extban) { -#if (USERLEN + NICKLEN + HOSTLEN + 32) > 256 - #error "wtf?" +#if (NICKLEN + USERLEN + HOSTLEN + 32) > MAXBANLEN + #error "MAXBANLEN is not sufficient to hold n!u@h plus some extra for extban prefixes. wtf?" #endif - static char retbuf[256]; - static char printbuf[256]; + static char retbuf[MAXBANLEN+1]; char *mask; - char tmpbuf[USERLEN + NICKLEN + HOSTLEN + 32]; + char tmpbuf[MAXBANLEN+1]; const char *ret = NULL; const char *nextbanstr; Extban *extban = NULL;