1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-09 23:23:14 +02:00

Fix crash when using deny link::rule with oversized argument.

Reported by moody in https://bugs.unrealircd.org/view.php?id=5667
This commit is contained in:
Bram Matthys
2020-05-08 14:58:49 +02:00
parent 6a3a2530b1
commit 606a35bed0
+11 -3
View File
@@ -306,7 +306,7 @@ int crule_gettoken(int *next_tokp, char **ruleptr)
void crule_getword(char *word, int *wordlenp, int maxlen, char **ruleptr)
{
char *word_ptr;
char *word_ptr, c;
word_ptr = word;
/* Both - and : can appear in hostnames so they must not be
@@ -315,8 +315,16 @@ void crule_getword(char *word, int *wordlenp, int maxlen, char **ruleptr)
while ((isalnum(**ruleptr)) || (**ruleptr == '*') ||
(**ruleptr == '?') || (**ruleptr == '.') || (**ruleptr == '-') ||
(**ruleptr == ':'))
*word_ptr++ = *(*ruleptr)++;
*word_ptr = '\0';
{
c = *(*ruleptr)++;
if (maxlen > 1) /* >1 instead of >0 so we (possibly) still have room for NUL */
{
*word_ptr++ = c;
maxlen--;
}
}
if (maxlen)
*word_ptr = '\0';
*wordlenp = word_ptr - word;
}