wm: ircd

Download patch

ref: 5d2338c792aeaa175d919b83ff6d5e87d5411967
parent: 55315f093c7d65613bffdf87b7efab7a42798bfa
author: mkf <mkf@cloud9p.org>
date: Fri Sep 22 09:17:18 EDT 2023

improve nick handling a bit

--- a/ircd.c
+++ b/ircd.c
@@ -445,14 +445,16 @@
 {
 	int i;
 	char c;
+	char ok[] = ";0123456789-";
 
+	/* first char my not be from ok*/
+	if(strchr(ok, s[0]))
+		return 0;
 	i = 0;
 	while((c = s[i]) != '\0' && i < maxlen){
-		if(!((c >= 'a' && c <= 'z') ||
-		     (c >= 'A' && c <= 'Z') ||
-		     (c >= '0' && c <= '9') ||
-		     (c == '_') || (c == ']') ||
-		     (c == '[') || (c == '-')))
+		if (c < 'A' && !strchr(ok, c))
+			return 0;
+		if (c > '}')
 			return 0;
 		i++;
 	}