summaryrefslogtreecommitdiff
path: root/chat/unrealircd/patches/patch-ag
blob: 10d8261571b60ba9a2d6a4b0cf78a5295b7d30d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
$NetBSD: patch-ag,v 1.1 2009/04/13 16:20:52 adrianp Exp $

--- src/s_conf.c.orig	2007-06-27 12:36:31.000000000 +0100
+++ src/s_conf.c
@@ -2663,25 +2663,15 @@ int	AllowClient(aClient *cptr, struct ho
 			Debug((DEBUG_DNS, "a_il: %s->%s", sockhost, fullname));
 			if (index(aconf->hostname, '@'))
 			{
-				/*
-				 * Doing strlcpy / strlcat here
-				 * would simply be a waste. We are
-				 * ALREADY sure that it is proper 
-				 * lengths
-				*/
 				if (aconf->flags.noident)
-					strcpy(uhost, username);
+					strlcpy(uhost, username, sizeof(uhost));
 				else
-					strcpy(uhost, cptr->username);
-				strcat(uhost, "@");
+					strlcpy(uhost, cptr->username, sizeof(uhost));
+				strlcat(uhost, "@", sizeof(uhost));
 			}
 			else
 				*uhost = '\0';
-			/* 
-			 * Same here as above
-			 * -Stskeeps 
-			*/
-			strncat(uhost, fullname, sizeof(uhost) - strlen(uhost));
+			strlcat(uhost, fullname, sizeof(uhost));
 			if (!match(aconf->hostname, uhost))
 				goto attach;
 		}
@@ -2692,11 +2682,11 @@ int	AllowClient(aClient *cptr, struct ho
 				strncpyzt(uhost, username, sizeof(uhost));
 			else
 				strncpyzt(uhost, cptr->username, sizeof(uhost));
-			(void)strcat(uhost, "@");
+			(void)strlcat(uhost, "@", sizeof(uhost));
 		}
 		else
 			*uhost = '\0';
-		(void)strncat(uhost, sockhost, sizeof(uhost) - strlen(uhost));
+		strlcat(uhost, sockhost, sizeof(uhost));
 		/* Check the IP */
 		if (match_ip(cptr->ip, uhost, aconf->ip, aconf->netmask))
 			goto attach;