strlcat -> rb_strlcat

This commit is contained in:
Valery Yatsko 2008-04-20 08:44:04 +04:00
parent 907468c485
commit a64c5173a7
14 changed files with 29 additions and 95 deletions

View File

@ -102,7 +102,7 @@ do_host_cloak(const char *inbuf, char *outbuf, int ipmask)
/* 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",

View File

@ -71,8 +71,8 @@ char *reconstruct_parv(int parc, const char *parv[])
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;
}

View File

@ -105,8 +105,8 @@ mo_omode(struct Client *client_p, struct Client *source_p, int parc, const char
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,

View File

@ -91,10 +91,6 @@ int inetpton(int af, const char *src, void *dst);
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

View File

@ -205,7 +205,7 @@ m_join(struct Client *client_p, struct Client *source_p, int parc, const char *p
if(*jbuf)
(void) strcat(jbuf, ",");
(void) strlcat(jbuf, name, sizeof(jbuf));
(void) rb_strlcat(jbuf, name, sizeof(jbuf));
}
if(parc > 2)

View File

@ -417,8 +417,8 @@ mo_masktrace(struct Client *client_p, struct Client *source_p, int parc,
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);

View File

@ -92,12 +92,12 @@ dump_map(struct Client *client_p, struct Client *root_p, char *pbuf)
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] = ' ';

View File

@ -107,17 +107,17 @@ static void show_privs(struct Client *source_p, struct Client *target_p)
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)
@ -125,8 +125,8 @@ static void show_privs(struct Client *source_p, struct Client *target_p)
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++;
}

View File

@ -285,8 +285,8 @@ do_rehash(struct Client *source_p, const char *type)
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);
}

View File

@ -181,8 +181,8 @@ scan_umodes(struct Client *client_p, struct Client *source_p, int parc,
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);
}

View File

@ -1161,7 +1161,7 @@ channel_modes(struct Channel *chptr, struct Client *client_p)
*mbuf = '\0';
rb_strlcpy(final, buf1, sizeof final);
strlcat(final, buf2, sizeof final);
rb_strlcat(final, buf2, sizeof final);
return final;
}

View File

@ -725,68 +725,6 @@ inetpton(af, src, dst)
/* 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)
{

View File

@ -314,7 +314,7 @@ verify_access(struct Client *client_p, const char *username)
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,

View File

@ -162,12 +162,12 @@ show_isupport(struct Client *client_p)
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++;