diff --git a/Changelog b/Changelog index 7023f28..17b0b96 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,7 @@ [Changes 1.2c01] +* Add sanity checking of incoming nicknames. (caf) + * /MV (massvoice) shouldn't send +v for already-voiced users. (caf) * Fix lag check on recent 32 bit OpenBSD / NetBSD (reported by DJ). (caf) diff --git a/source/parse.c b/source/parse.c index 861aee9..fe9b98d 100644 --- a/source/parse.c +++ b/source/parse.c @@ -1950,6 +1950,17 @@ void parse_server(char *orig_line) /* XXXX - i dont think 'from' can be null here. */ if (!(comm = (*ArgList++)) || !from || !*ArgList) return; /* Serious protocol violation -- ByeBye */ + + /* Check for egregiously bad nicknames */ +#define islegal(c) (((c) >= 'A' && (c) <= '}') || \ + ((c) >= '0' && (c) <= '9') || (c) == '-' || (c & 0x80)) + + if (*from && !strchr(from, '.') && !islegal(*from)) + { + rfc1459_odd(from, comm, ArgList); + return; + } + #ifdef WANT_TCL if (check_tcl_raw(copy, comm)) return;