From e456f621efcc8a9f11efd5ba76f653c4682d8cd0 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Mon, 11 Jun 2018 08:02:35 +0200 Subject: [PATCH] Fix OOB read in extended bans handling. (Bug caused by commit dd6f67a26658409294a75e010ef65700588baacf) --- src/modules/m_mode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/m_mode.c b/src/modules/m_mode.c index 9bc066e5a..5de32d04b 100644 --- a/src/modules/m_mode.c +++ b/src/modules/m_mode.c @@ -1065,7 +1065,7 @@ int do_mode_char(aChannel *chptr, long modetype, char modechar, char *param, if (BadPtr(tmpstr)) { /* Invalid ban. See if we can send an error about that */ - if ((param[0] == '~') && MyClient(cptr) && !bounce) + if ((param[0] == '~') && MyClient(cptr) && !bounce && (strlen(param) > 2)) { Extban *p = findmod_by_bantype(param[1]); if (p && p->is_ok) @@ -1113,7 +1113,7 @@ int do_mode_char(aChannel *chptr, long modetype, char modechar, char *param, tmpstr = clean_ban_mask(param, what, cptr); if (BadPtr(tmpstr)) break; /* ignore except, but eat param */ - if ((tmpstr[0] == '~') && MyClient(cptr) && !bounce) + if ((tmpstr[0] == '~') && MyClient(cptr) && !bounce && (strlen(param) > 2)) { /* extban: check access if needed */ Extban *p = findmod_by_bantype(tmpstr[1]); @@ -1152,7 +1152,7 @@ int do_mode_char(aChannel *chptr, long modetype, char modechar, char *param, tmpstr = clean_ban_mask(param, what, cptr); if (BadPtr(tmpstr)) break; /* ignore except, but eat param */ - if ((tmpstr[0] == '~') && MyClient(cptr) && !bounce) + if ((tmpstr[0] == '~') && MyClient(cptr) && !bounce && (strlen(param) > 2)) { /* extban: check access if needed */ Extban *p = findmod_by_bantype(tmpstr[1]);