Commits

Anonymous committed a3800df

strlcat -> rb_strlcat

Comments (0)

Files changed (14)

extensions/ip_cloaking_old.c

 		/* try to avoid truncation -- jilles */
 		while (len1 + strlen(rest) >= HOSTLEN && (next = strchr(rest + 1, '.')) != NULL)
 			rest = next;
-		strlcat(outbuf, rest, HOSTLEN);
+		rb_strlcat(outbuf, rest, HOSTLEN);
 	}
 	else
 		rb_snprintf(outbuf, HOSTLEN, "%X%X.%s",

extensions/m_identify.c

 	rb_strlcpy(tmpbuf, parv[0], BUFSIZE);
 	for (i = 1; i < parc; i++)
 	{
-		strlcat(tmpbuf, " ", BUFSIZE);
-		strlcat(tmpbuf, parv[i], BUFSIZE);
+		rb_strlcat(tmpbuf, " ", BUFSIZE);
+		rb_strlcat(tmpbuf, parv[i], BUFSIZE);
 	}
 	return tmpbuf;
 }

extensions/m_omode.c

 	for (i = 2; i < parc; i++)
 	{
 		if (i != 2)
-			strlcat(params, " ", sizeof params);
-		strlcat(params, parv[i], sizeof params);
+			rb_strlcat(params, " ", sizeof params);
+		rb_strlcat(params, parv[i], sizeof params);
 	}
 
 	sendto_wallops_flags(UMODE_WALLOP, &me, 

include/irc_string.h

 const char *inetntop_sock(struct sockaddr *src, char *dst, unsigned int size);
 int inetpton_sock(const char *src, struct sockaddr *dst);
 
-#ifndef HAVE_STRLCAT
-size_t strlcat(char *dst, const char *src, size_t siz);
-#endif
-
 /*
  * clean_string - cleanup control and high ascii characters
  * -Dianora

modules/core/m_join.c

 
 		if(*jbuf)
 			(void) strcat(jbuf, ",");
-		(void) strlcat(jbuf, name, sizeof(jbuf));
+		(void) rb_strlcat(jbuf, name, sizeof(jbuf));
 	}
 
 	if(parc > 2)

modules/m_etrace.c

 			char buf[512];
 			rb_strlcpy(buf, mask, sizeof(buf));
 			if(!EmptyString(gecos)) {
-				strlcat(buf, " ", sizeof(buf));
-				strlcat(buf, gecos, sizeof(buf));
+				rb_strlcat(buf, " ", sizeof(buf));
+				rb_strlcat(buf, gecos, sizeof(buf));
 			}		
 
 			report_operspy(source_p, "MASKTRACE", buf);	
 	rb_dlink_node *ptr;
 	*pbuf = '\0';
 
-	strlcat(pbuf, root_p->name, BUFSIZE);
+	rb_strlcat(pbuf, root_p->name, BUFSIZE);
 	if (has_id(root_p))
 	{
-		strlcat(pbuf, "[", BUFSIZE);
-		strlcat(pbuf, root_p->id, BUFSIZE);
-		strlcat(pbuf, "]", BUFSIZE);
+		rb_strlcat(pbuf, "[", BUFSIZE);
+		rb_strlcat(pbuf, root_p->id, BUFSIZE);
+		rb_strlcat(pbuf, "]", BUFSIZE);
 	}
 	len = strlen(buf);
 	buf[len] = ' ';

modules/m_privs.c

 		if (target_p->flags2 & p->mode)
 		{
 			if (buf[0] != '\0')
-				strlcat(buf, " ", sizeof buf);
-			strlcat(buf, p->name, sizeof buf);
+				rb_strlcat(buf, " ", sizeof buf);
+			rb_strlcat(buf, p->name, sizeof buf);
 		}
 		p++;
 	}
 	if (IsOper(target_p))
 	{
 		if (buf[0] != '\0')
-			strlcat(buf, " ", sizeof buf);
-		strlcat(buf, "operator:", sizeof buf);
-		strlcat(buf, target_p->localClient->opername, sizeof buf);
+			rb_strlcat(buf, " ", sizeof buf);
+		rb_strlcat(buf, "operator:", sizeof buf);
+		rb_strlcat(buf, target_p->localClient->opername, sizeof buf);
 	}
 	p = &auth_client_table[0];
 	while (p->name != NULL)
 		if (target_p->flags2 & p->mode)
 		{
 			if (buf[0] != '\0')
-				strlcat(buf, " ", sizeof buf);
-			strlcat(buf, p->name, sizeof buf);
+				rb_strlcat(buf, " ", sizeof buf);
+			rb_strlcat(buf, p->name, sizeof buf);
 		}
 		p++;
 	}

modules/m_rehash.c

 		for (x = 0; rehash_commands[x].cmd != NULL && rehash_commands[x].handler != NULL;
 		     x++)
 		{
-			strlcat(cmdbuf, " ", sizeof(cmdbuf));
-			strlcat(cmdbuf, rehash_commands[x].cmd, sizeof(cmdbuf));
+			rb_strlcat(cmdbuf, " ", sizeof(cmdbuf));
+			rb_strlcat(cmdbuf, rehash_commands[x].cmd, sizeof(cmdbuf));
 		}
 		sendto_one_notice(source_p, ":rehash one of:%s", cmdbuf);
 	}
 				rb_strlcpy(buf, "UMODES", sizeof buf);
 				for (i = 2; i < parc; i++)
 				{
-					strlcat(buf, " ", sizeof buf);
-					strlcat(buf, parv[i], sizeof buf);
+					rb_strlcat(buf, " ", sizeof buf);
+					rb_strlcat(buf, parv[i], sizeof buf);
 				}
 				report_operspy(source_p, "SCAN", buf);
 			}
 	*mbuf = '\0';
 
 	rb_strlcpy(final, buf1, sizeof final);
-	strlcat(final, buf2, sizeof final);
+	rb_strlcat(final, buf2, sizeof final);
 	return final;
 }
 
 	/* NOTREACHED */
 }
 
-/*
- * strlcat and strlcpy were ripped from openssh 2.5.1p2
- * They had the following Copyright info: 
- *
- *
- * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright    
- *    notice, this list of conditions and the following disclaimer in the  
- *    documentation and/or other materials provided with the distribution. 
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED `AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
- * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-
-#ifndef HAVE_STRLCAT
-size_t
-strlcat(char *dst, const char *src, size_t siz)
-{
-	char *d = dst;
-	const char *s = src;
-	size_t n = siz, dlen;
-
-	while(n-- != 0 && *d != '\0')
-		d++;
-	dlen = d - dst;
-	n = siz - dlen;
-
-	if(n == 0)
-		return (dlen + strlen(s));
-	while(*s != '\0')
-	{
-		if(n != 1)
-		{
-			*d++ = *s;
-			n--;
-		}
-		s++;
-	}
-	*d = '\0';
-	return (dlen + (s - src));	/* count does not include NUL */
-}
-#endif
-
 char *
 strip_colour(char *string)
 {
 	else
 	{
 		rb_strlcpy(non_ident, "~", sizeof(non_ident));
-		strlcat(non_ident, username, sizeof(non_ident));
+		rb_strlcat(non_ident, username, sizeof(non_ident));
 		aconf = find_address_conf(client_p->host, client_p->sockhost,
 					non_ident, client_p->username,
 					(struct sockaddr *) &client_p->localClient->ip,
 			nchars = extra_space, nparams = 0, buf[0] = '\0';
 		}
 		if (nparams > 0)
-			strlcat(buf, " ", sizeof buf), nchars++;
-		strlcat(buf, item->name, sizeof buf);
+			rb_strlcat(buf, " ", sizeof buf), nchars++;
+		rb_strlcat(buf, item->name, sizeof buf);
 		if (!EmptyString(value))
 		{
-			strlcat(buf, "=", sizeof buf);
-			strlcat(buf, value, sizeof buf);
+			rb_strlcat(buf, "=", sizeof buf);
+			rb_strlcat(buf, value, sizeof buf);
 		}
 		nchars += l;
 		nparams++;