strlcpy -> rb_strlcpy

This commit is contained in:
Valery Yatsko 2008-04-20 08:40:40 +04:00
parent 6af128685d
commit f427c8b00d
43 changed files with 118 additions and 152 deletions

View file

@ -175,7 +175,7 @@ check_umode_change(void *vdata)
}
if (strcmp(source_p->host, source_p->localClient->mangledhost))
{
strlcpy(source_p->host, source_p->localClient->mangledhost, HOSTLEN);
rb_strlcpy(source_p->host, source_p->localClient->mangledhost, HOSTLEN);
distribute_hostchange(source_p);
}
else /* not really nice, but we need to send this numeric here */
@ -187,7 +187,7 @@ check_umode_change(void *vdata)
if (source_p->localClient->mangledhost != NULL &&
!strcmp(source_p->host, source_p->localClient->mangledhost))
{
strlcpy(source_p->host, source_p->orighost, HOSTLEN);
rb_strlcpy(source_p->host, source_p->orighost, HOSTLEN);
distribute_hostchange(source_p);
}
}
@ -212,7 +212,7 @@ check_new_user(void *vdata)
source_p->umodes &= ~user_modes['h'];
if (source_p->umodes & user_modes['h'])
{
strlcpy(source_p->host, source_p->localClient->mangledhost, sizeof(source_p->host));
rb_strlcpy(source_p->host, source_p->localClient->mangledhost, sizeof(source_p->host));
if (irccmp(source_p->host, source_p->orighost))
SetDynSpoof(source_p);
}

View file

@ -131,7 +131,7 @@ check_umode_change(void *vdata)
}
if (strcmp(source_p->host, source_p->localClient->mangledhost))
{
strlcpy(source_p->host, source_p->localClient->mangledhost, HOSTLEN);
rb_strlcpy(source_p->host, source_p->localClient->mangledhost, HOSTLEN);
distribute_hostchange(source_p);
}
else /* not really nice, but we need to send this numeric here */
@ -143,7 +143,7 @@ check_umode_change(void *vdata)
if (source_p->localClient->mangledhost != NULL &&
!strcmp(source_p->host, source_p->localClient->mangledhost))
{
strlcpy(source_p->host, source_p->orighost, HOSTLEN);
rb_strlcpy(source_p->host, source_p->orighost, HOSTLEN);
distribute_hostchange(source_p);
}
}
@ -168,7 +168,7 @@ check_new_user(void *vdata)
source_p->umodes &= ~user_modes['h'];
if (source_p->umodes & user_modes['h'])
{
strlcpy(source_p->host, source_p->localClient->mangledhost, sizeof(source_p->host));
rb_strlcpy(source_p->host, source_p->localClient->mangledhost, sizeof(source_p->host));
if (irccmp(source_p->host, source_p->orighost))
SetDynSpoof(source_p);
}

View file

@ -68,7 +68,7 @@ char *reconstruct_parv(int parc, const char *parv[])
{
static char tmpbuf[BUFSIZE]; int i;
strlcpy(tmpbuf, parv[0], BUFSIZE);
rb_strlcpy(tmpbuf, parv[0], BUFSIZE);
for (i = 1; i < parc; i++)
{
strlcat(tmpbuf, " ", BUFSIZE);

View file

@ -118,12 +118,12 @@ mr_webirc(struct Client *client_p, struct Client *source_p, int parc, const char
}
strlcpy(source_p->sockhost, parv[4], sizeof(source_p->sockhost));
rb_strlcpy(source_p->sockhost, parv[4], sizeof(source_p->sockhost));
if(strlen(parv[3]) <= HOSTLEN)
strlcpy(source_p->host, parv[3], sizeof(source_p->host));
rb_strlcpy(source_p->host, parv[3], sizeof(source_p->host));
else
strlcpy(source_p->host, source_p->sockhost, sizeof(source_p->host));
rb_strlcpy(source_p->host, source_p->sockhost, sizeof(source_p->host));
del_unknown_ip(source_p);
inetpton_sock(parv[4], (struct sockaddr *)&source_p->localClient->ip);

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_STRLCPY
size_t strlcpy(char *dst, const char *src, size_t siz);
#endif
#ifndef HAVE_STRLCAT
size_t strlcat(char *dst, const char *src, size_t siz);
#endif

View file

@ -624,7 +624,7 @@ ms_sjoin(struct Client *client_p, struct Client *source_p, int parc, const char
mode.mode |= MODE_DISFORWARD;
break;
case 'f':
strlcpy(mode.forward, parv[4 + args], sizeof(mode.forward));
rb_strlcpy(mode.forward, parv[4 + args], sizeof(mode.forward));
args++;
if(parc < 5 + args)
return 0;
@ -638,7 +638,7 @@ ms_sjoin(struct Client *client_p, struct Client *source_p, int parc, const char
return 0;
break;
case 'k':
strlcpy(mode.key, parv[4 + args], sizeof(mode.key));
rb_strlcpy(mode.key, parv[4 + args], sizeof(mode.key));
args++;
if(parc < 5 + args)
return 0;

View file

@ -451,7 +451,7 @@ msg_channel(int p_or_n, const char *command,
if(chptr->mode.mode & MODE_NOCOLOR)
{
strlcpy(text2, text, BUFSIZE);
rb_strlcpy(text2, text, BUFSIZE);
strip_colour(text2);
text = text2;
if (EmptyString(text))

View file

@ -139,7 +139,7 @@ mr_nick(struct Client *client_p, struct Client *source_p, int parc, const char *
*s = '\0';
/* copy the nick and terminate it */
strlcpy(nick, parv[1], sizeof(nick));
rb_strlcpy(nick, parv[1], sizeof(nick));
/* check the nickname is ok */
if(!clean_nick(nick, 1))
@ -203,7 +203,7 @@ m_nick(struct Client *client_p, struct Client *source_p, int parc, const char *p
flood_endgrace(source_p);
/* terminate nick to NICKLEN, we dont want clean_nick() to error! */
strlcpy(nick, parv[1], sizeof(nick));
rb_strlcpy(nick, parv[1], sizeof(nick));
/* check the nickname is ok */
if(!clean_nick(nick, 1))
@ -724,7 +724,7 @@ set_initial_nick(struct Client *client_p, struct Client *source_p, char *nick)
if(source_p->flags & FLAGS_SENTUSER)
{
strlcpy(buf, source_p->username, sizeof(buf));
rb_strlcpy(buf, source_p->username, sizeof(buf));
/* got user, heres nick. */
register_local_user(client_p, source_p, buf);
@ -1173,35 +1173,35 @@ register_client(struct Client *client_p, struct Client *server,
source_p->tsinfo = newts;
strcpy(source_p->name, nick);
strlcpy(source_p->username, parv[5], sizeof(source_p->username));
strlcpy(source_p->host, parv[6], sizeof(source_p->host));
strlcpy(source_p->orighost, source_p->host, sizeof(source_p->orighost));
rb_strlcpy(source_p->username, parv[5], sizeof(source_p->username));
rb_strlcpy(source_p->host, parv[6], sizeof(source_p->host));
rb_strlcpy(source_p->orighost, source_p->host, sizeof(source_p->orighost));
if(parc == 12)
{
strlcpy(source_p->info, parv[11], sizeof(source_p->info));
strlcpy(source_p->sockhost, parv[7], sizeof(source_p->sockhost));
strlcpy(source_p->id, parv[8], sizeof(source_p->id));
rb_strlcpy(source_p->info, parv[11], sizeof(source_p->info));
rb_strlcpy(source_p->sockhost, parv[7], sizeof(source_p->sockhost));
rb_strlcpy(source_p->id, parv[8], sizeof(source_p->id));
add_to_id_hash(source_p->id, source_p);
if (strcmp(parv[9], "*"))
{
strlcpy(source_p->orighost, parv[9], sizeof(source_p->orighost));
rb_strlcpy(source_p->orighost, parv[9], sizeof(source_p->orighost));
if (irccmp(source_p->host, source_p->orighost))
SetDynSpoof(source_p);
}
if (strcmp(parv[10], "*"))
strlcpy(source_p->user->suser, parv[10], sizeof(source_p->user->suser));
rb_strlcpy(source_p->user->suser, parv[10], sizeof(source_p->user->suser));
}
else if(parc == 10)
{
strlcpy(source_p->info, parv[9], sizeof(source_p->info));
strlcpy(source_p->sockhost, parv[7], sizeof(source_p->sockhost));
strlcpy(source_p->id, parv[8], sizeof(source_p->id));
rb_strlcpy(source_p->info, parv[9], sizeof(source_p->info));
rb_strlcpy(source_p->sockhost, parv[7], sizeof(source_p->sockhost));
rb_strlcpy(source_p->id, parv[8], sizeof(source_p->id));
add_to_id_hash(source_p->id, source_p);
}
else
{
strlcpy(source_p->info, parv[8], sizeof(source_p->info));
rb_strlcpy(source_p->info, parv[8], sizeof(source_p->info));
}
/* remove any nd entries for this nick */

View file

@ -71,7 +71,7 @@ m_part(struct Client *client_p, struct Client *source_p, int parc, const char *p
reason[0] = '\0';
if(parc > 2)
strlcpy(reason, parv[2], sizeof(reason));
rb_strlcpy(reason, parv[2], sizeof(reason));
name = strtoken(&p, s, ",");

View file

@ -79,7 +79,7 @@ mr_server(struct Client *client_p, struct Client *source_p, int parc, const char
name = parv[1];
hop = atoi(parv[2]);
strlcpy(info, parv[3], sizeof(info));
rb_strlcpy(info, parv[3], sizeof(info));
if (IsHandshake(client_p) && irccmp(client_p->name, name))
{
@ -230,7 +230,7 @@ mr_server(struct Client *client_p, struct Client *source_p, int parc, const char
* C:line in client_p->name
*/
strlcpy(client_p->name, name, sizeof(client_p->name));
rb_strlcpy(client_p->name, name, sizeof(client_p->name));
set_server_gecos(client_p, info);
client_p->hopcount = hop;
server_estab(client_p);
@ -261,7 +261,7 @@ ms_server(struct Client *client_p, struct Client *source_p, int parc, const char
name = parv[1];
hop = atoi(parv[2]);
strlcpy(info, parv[3], sizeof(info));
rb_strlcpy(info, parv[3], sizeof(info));
if((target_p = find_server(NULL, name)))
{
@ -421,7 +421,7 @@ ms_server(struct Client *client_p, struct Client *source_p, int parc, const char
make_server(target_p);
target_p->hopcount = hop;
strlcpy(target_p->name, name, sizeof(target_p->name));
rb_strlcpy(target_p->name, name, sizeof(target_p->name));
set_server_gecos(target_p, info);
@ -569,7 +569,7 @@ ms_sid(struct Client *client_p, struct Client *source_p, int parc, const char *p
target_p = make_client(client_p);
make_server(target_p);
strlcpy(target_p->name, parv[1], sizeof(target_p->name));
rb_strlcpy(target_p->name, parv[1], sizeof(target_p->name));
target_p->hopcount = atoi(parv[2]);
strcpy(target_p->id, parv[3]);
set_server_gecos(target_p, parv[4]);
@ -668,13 +668,13 @@ set_server_gecos(struct Client *client_p, const char *info)
/* if there was a trailing space, s could point to \0, so check */
if(s && (*s != '\0'))
{
strlcpy(client_p->info, s, sizeof(client_p->info));
rb_strlcpy(client_p->info, s, sizeof(client_p->info));
return 1;
}
}
}
strlcpy(client_p->info, "(Unknown Location)", sizeof(client_p->info));
rb_strlcpy(client_p->info, "(Unknown Location)", sizeof(client_p->info));
return 1;
}

View file

@ -116,7 +116,7 @@ clicap_find(const char *data, int *negate, int *finished)
if(data)
{
strlcpy(buf, data, sizeof(buf));
rb_strlcpy(buf, data, sizeof(buf));
p = buf;
}
@ -322,7 +322,7 @@ cap_end(struct Client *source_p, const char *arg)
if(source_p->name[0] && source_p->user)
{
char buf[USERLEN+1];
strlcpy(buf, source_p->username, sizeof(buf));
rb_strlcpy(buf, source_p->username, sizeof(buf));
register_local_user(source_p, source_p, buf);
}
}

View file

@ -229,7 +229,7 @@ m_challenge(struct Client *client_p, struct Client *source_p, int parc, const ch
source_p->localClient->chal_time = rb_current_time();
for(;;)
{
cnt = strlcpy(chal_line, chal, CHALLENGE_WIDTH);
cnt = rb_strlcpy(chal_line, chal, CHALLENGE_WIDTH);
sendto_one(source_p, form_str(RPL_RSACHALLENGE2), me.name, source_p->name, chal_line);
if(cnt > CHALLENGE_WIDTH)
chal += CHALLENGE_WIDTH - 1;

View file

@ -94,7 +94,7 @@ me_realhost(struct Client *client_p, struct Client *source_p,
return 0;
del_from_hostname_hash(source_p->orighost, source_p);
strlcpy(source_p->orighost, parv[1], sizeof source_p->orighost);
rb_strlcpy(source_p->orighost, parv[1], sizeof source_p->orighost);
if (irccmp(source_p->host, source_p->orighost))
SetDynSpoof(source_p);
else

View file

@ -103,7 +103,7 @@ mo_dline(struct Client *client_p, struct Client *source_p,
}
dlhost = parv[loc];
strlcpy(cidr_form_host, dlhost, sizeof(cidr_form_host));
rb_strlcpy(cidr_form_host, dlhost, sizeof(cidr_form_host));
if(!parse_netmask(dlhost, NULL, &bits))
{
@ -284,7 +284,7 @@ mo_undline(struct Client *client_p, struct Client *source_p, int parc, const cha
return 0;
}
strlcpy(buf, aconf->host, sizeof buf);
rb_strlcpy(buf, aconf->host, sizeof buf);
if(remove_temp_dline(aconf))
{
sendto_one(source_p,
@ -318,7 +318,7 @@ mo_undline(struct Client *client_p, struct Client *source_p, int parc, const cha
while (fgets(buf, sizeof(buf), in))
{
strlcpy(buff, buf, sizeof(buff));
rb_strlcpy(buff, buf, sizeof(buff));
if((p = strchr(buff, '\n')) != NULL)
*p = '\0';

View file

@ -415,7 +415,7 @@ mo_masktrace(struct Client *client_p, struct Client *source_p, int parc,
if (!ConfigFileEntry.operspy_dont_care_user_info)
{
char buf[512];
strlcpy(buf, mask, sizeof(buf));
rb_strlcpy(buf, mask, sizeof(buf));
if(!EmptyString(gecos)) {
strlcat(buf, " ", sizeof(buf));
strlcat(buf, gecos, sizeof(buf));

View file

@ -554,11 +554,11 @@ find_user_host(struct Client *source_p, const char *userhost, char *luser, char
{
*(hostp++) = '\0'; /* short and squat */
if(*userhost)
strlcpy(luser, userhost, USERLEN + 1); /* here is my user */
rb_strlcpy(luser, userhost, USERLEN + 1); /* here is my user */
else
strcpy(luser, "*");
if(*hostp)
strlcpy(lhost, hostp, HOSTLEN + 1); /* here is my host */
rb_strlcpy(lhost, hostp, HOSTLEN + 1); /* here is my host */
else
strcpy(lhost, "*");
}
@ -572,7 +572,7 @@ find_user_host(struct Client *source_p, const char *userhost, char *luser, char
luser[0] = '*'; /* no @ found, assume its *@somehost */
luser[1] = '\0';
strlcpy(lhost, userhost, HOSTLEN + 1);
rb_strlcpy(lhost, userhost, HOSTLEN + 1);
}
return 1;

View file

@ -111,7 +111,7 @@ mr_pong(struct Client *client_p, struct Client *source_p, int parc, const char *
if(source_p->localClient->random_ping == incoming_ping)
{
char buf[USERLEN + 1];
strlcpy(buf, source_p->username, sizeof(buf));
rb_strlcpy(buf, source_p->username, sizeof(buf));
source_p->flags |= FLAGS_PING_COOKIE;
register_local_user(client_p, source_p, buf);
}

View file

@ -577,7 +577,7 @@ remove_resv_from_file(struct Client *source_p, const char *name)
break;
}
strlcpy(buff, buf, sizeof(buff));
rb_strlcpy(buff, buf, sizeof(buff));
if((p = strchr(buff, '\n')) != NULL)
*p = '\0';

View file

@ -150,7 +150,7 @@ me_sasl(struct Client *client_p, struct Client *source_p,
if(*target_p->preClient->sasl_agent && strncmp(parv[1], target_p->preClient->sasl_agent, IDLEN))
return 0;
else if(!*target_p->preClient->sasl_agent)
strlcpy(target_p->preClient->sasl_agent, parv[1], IDLEN);
rb_strlcpy(target_p->preClient->sasl_agent, parv[1], IDLEN);
if(*parv[3] == 'C')
sendto_one(target_p, "AUTHENTICATE %s", parv[4]);

View file

@ -178,7 +178,7 @@ scan_umodes(struct Client *client_p, struct Client *source_p, int parc,
{
if (!ConfigFileEntry.operspy_dont_care_user_info)
{
strlcpy(buf, "UMODES", sizeof buf);
rb_strlcpy(buf, "UMODES", sizeof buf);
for (i = 2; i < parc; i++)
{
strlcat(buf, " ", sizeof buf);

View file

@ -106,7 +106,7 @@ me_su(struct Client *client_p, struct Client *source_p,
if(EmptyString(parv[2]))
target_p->user->suser[0] = '\0';
else
strlcpy(target_p->user->suser, parv[2], sizeof(target_p->user->suser));
rb_strlcpy(target_p->user->suser, parv[2], sizeof(target_p->user->suser));
invalidate_bancache_user(target_p);
@ -120,7 +120,7 @@ me_login(struct Client *client_p, struct Client *source_p,
if(!IsPerson(source_p))
return 0;
strlcpy(source_p->user->suser, parv[1], sizeof(source_p->user->suser));
rb_strlcpy(source_p->user->suser, parv[1], sizeof(source_p->user->suser));
return 0;
}

View file

@ -257,7 +257,7 @@ quote_operstring(struct Client *source_p, const char *arg)
}
else
{
strlcpy(GlobalSetOptions.operstring, arg,
rb_strlcpy(GlobalSetOptions.operstring, arg,
sizeof(GlobalSetOptions.operstring));
sendto_realops_snomask(SNO_GENERAL, L_ALL,
@ -276,7 +276,7 @@ quote_adminstring(struct Client *source_p, const char *arg)
}
else
{
strlcpy(GlobalSetOptions.adminstring, arg,
rb_strlcpy(GlobalSetOptions.adminstring, arg,
sizeof(GlobalSetOptions.adminstring));
sendto_realops_snomask(SNO_GENERAL, L_ALL,

View file

@ -163,41 +163,41 @@ me_svslogin(struct Client *client_p, struct Client *source_p,
if(clean_nick(parv[2]))
{
strlcpy(nick, parv[2], NICKLEN + 1);
rb_strlcpy(nick, parv[2], NICKLEN + 1);
valid |= NICK_VALID;
}
else if(*target_p->name)
strlcpy(nick, target_p->name, NICKLEN + 1);
rb_strlcpy(nick, target_p->name, NICKLEN + 1);
else
strcpy(nick, "*");
if(clean_username(parv[3]))
{
strlcpy(user, parv[3], USERLEN + 1);
rb_strlcpy(user, parv[3], USERLEN + 1);
valid |= USER_VALID;
}
else
strlcpy(user, target_p->username, USERLEN + 1);
rb_strlcpy(user, target_p->username, USERLEN + 1);
if(clean_host(parv[4]))
{
strlcpy(host, parv[4], HOSTLEN + 1);
rb_strlcpy(host, parv[4], HOSTLEN + 1);
valid |= HOST_VALID;
}
else
strlcpy(host, target_p->host, HOSTLEN + 1);
rb_strlcpy(host, target_p->host, HOSTLEN + 1);
if(*parv[5] == '*')
{
if(target_p->user)
strlcpy(login, target_p->user->suser, NICKLEN + 1);
rb_strlcpy(login, target_p->user->suser, NICKLEN + 1);
else
login[0] = '\0';
}
else if(!strcmp(parv[5], "0"))
login[0] = '\0';
else
strlcpy(login, parv[5], NICKLEN + 1);
rb_strlcpy(login, parv[5], NICKLEN + 1);
/* Login (mostly) follows nick rules. */
if(*login && !clean_nick(login))
@ -251,7 +251,7 @@ me_svslogin(struct Client *client_p, struct Client *source_p,
if(valid & HOST_VALID)
strcpy(target_p->preClient->spoofhost, host);
strlcpy(user_p->suser, login, NICKLEN + 1);
rb_strlcpy(user_p->suser, login, NICKLEN + 1);
}
else
{
@ -317,7 +317,7 @@ ms_signon(struct Client *client_p, struct Client *source_p,
else if(*parv[5] != '*')
{
if (clean_nick(parv[5]))
strlcpy(login, parv[5], NICKLEN + 1);
rb_strlcpy(login, parv[5], NICKLEN + 1);
else
return 0;
}

View file

@ -141,13 +141,13 @@ mo_testline(struct Client *client_p, struct Client *source_p, int parc, const ch
if (username != NULL)
{
strlcpy(user_trunc, username, sizeof user_trunc);
strlcpy(notildeuser_trunc, *username == '~' ? username + 1 : username, sizeof notildeuser_trunc);
rb_strlcpy(user_trunc, username, sizeof user_trunc);
rb_strlcpy(notildeuser_trunc, *username == '~' ? username + 1 : username, sizeof notildeuser_trunc);
}
else
{
strlcpy(user_trunc, "dummy", sizeof user_trunc);
strlcpy(notildeuser_trunc, "dummy", sizeof notildeuser_trunc);
rb_strlcpy(user_trunc, "dummy", sizeof user_trunc);
rb_strlcpy(notildeuser_trunc, "dummy", sizeof notildeuser_trunc);
}
/* now look for a matching I/K/G */
if((aconf = find_address_conf(host, NULL, user_trunc, notildeuser_trunc,

View file

@ -97,14 +97,14 @@ do_local_user(struct Client *client_p, struct Client *source_p,
source_p->flags |= FLAGS_SENTUSER;
}
strlcpy(source_p->info, realname, sizeof(source_p->info));
rb_strlcpy(source_p->info, realname, sizeof(source_p->info));
if(!IsGotId(source_p))
{
/* This is in this location for a reason..If there is no identd
* and ping cookies are enabled..we need to have a copy of this
*/
strlcpy(source_p->username, username, sizeof(source_p->username));
rb_strlcpy(source_p->username, username, sizeof(source_p->username));
}
if(source_p->name[0])

View file

@ -622,7 +622,7 @@ remove_xline_from_file(struct Client *source_p, const char *huntgecos)
break;
}
strlcpy(buff, buf, sizeof(buff));
rb_strlcpy(buff, buf, sizeof(buff));
if((p = strchr(buff, '\n')) != NULL)
*p = '\0';

View file

@ -106,7 +106,7 @@ static void blacklist_dns_callback(void *vptr, struct DNSReply *reply)
if (rb_dlink_list_length(&blcptr->client_p->preClient->dnsbl_queries) == 0 && blcptr->client_p->flags & FLAGS_SENTUSER && !EmptyString(blcptr->client_p->name))
{
char buf[USERLEN + 1];
strlcpy(buf, blcptr->client_p->username, sizeof buf);
rb_strlcpy(buf, blcptr->client_p->username, sizeof buf);
register_local_user(blcptr->client_p, blcptr->client_p, buf);
}
@ -154,8 +154,8 @@ struct Blacklist *new_blacklist(char *name, char *reject_reason)
}
else
blptr->status &= ~CONF_ILLEGAL;
strlcpy(blptr->host, name, HOSTLEN);
strlcpy(blptr->reject_reason, reject_reason, IRCD_BUFSIZE);
rb_strlcpy(blptr->host, name, HOSTLEN);
rb_strlcpy(blptr->reject_reason, reject_reason, IRCD_BUFSIZE);
blptr->lastwarning = 0;
return blptr;

View file

@ -1068,8 +1068,8 @@ set_channel_topic(struct Channel *chptr, const char *topic, const char *topic_in
{
if(chptr->topic == NULL)
allocate_topic(chptr);
strlcpy(chptr->topic, topic, TOPICLEN + 1);
strlcpy(chptr->topic_info, topic_info, USERHOST_REPLYLEN);
rb_strlcpy(chptr->topic, topic, TOPICLEN + 1);
rb_strlcpy(chptr->topic_info, topic_info, USERHOST_REPLYLEN);
chptr->topic_time = topicts;
}
else
@ -1160,7 +1160,7 @@ channel_modes(struct Channel *chptr, struct Client *client_p)
*mbuf = '\0';
strlcpy(final, buf1, sizeof final);
rb_strlcpy(final, buf1, sizeof final);
strlcat(final, buf2, sizeof final);
return final;
}

View file

@ -127,7 +127,7 @@ add_id(struct Client *source_p, struct Channel *chptr, const char *banid,
if(IsPerson(source_p))
rb_sprintf(who, "%s!%s@%s", source_p->name, source_p->username, source_p->host);
else
strlcpy(who, source_p->name, sizeof(who));
rb_strlcpy(who, source_p->name, sizeof(who));
actualBan = allocate_ban(realban, who);
actualBan->when = rb_current_time();
@ -1036,7 +1036,7 @@ chm_forward(struct Client *source_p, struct Channel *chptr,
}
}
strlcpy(chptr->mode.forward, forward, sizeof(chptr->mode.forward));
rb_strlcpy(chptr->mode.forward, forward, sizeof(chptr->mode.forward));
mode_changes[mode_count].letter = c;
mode_changes[mode_count].dir = MODE_ADD;
@ -1096,7 +1096,7 @@ chm_key(struct Client *source_p, struct Channel *chptr,
return;
s_assert(key[0] != ' ');
strlcpy(chptr->mode.key, key, sizeof(chptr->mode.key));
rb_strlcpy(chptr->mode.key, key, sizeof(chptr->mode.key));
mode_changes[mode_count].letter = c;
mode_changes[mode_count].dir = MODE_ADD;

View file

@ -1231,7 +1231,7 @@ dead_link(struct Client *client_p)
abt = (struct abort_client *) rb_malloc(sizeof(struct abort_client));
if(client_p->flags & FLAGS_SENDQEX)
strlcpy(abt->notice, "Max SendQ exceeded", sizeof(abt->notice));
rb_strlcpy(abt->notice, "Max SendQ exceeded", sizeof(abt->notice));
else
rb_snprintf(abt->notice, sizeof(abt->notice), "Write error: %s", strerror(errno));
@ -2053,7 +2053,7 @@ error_exit_client(struct Client *client_p, int error)
}
if(error == 0)
strlcpy(errmsg, "Remote host closed the connection", sizeof(errmsg));
rb_strlcpy(errmsg, "Remote host closed the connection", sizeof(errmsg));
else
rb_snprintf(errmsg, sizeof(errmsg), "Read error: %s", strerror(current_error));

View file

@ -787,36 +787,6 @@ strlcat(char *dst, const char *src, size_t siz)
}
#endif
#ifndef HAVE_STRLCPY
size_t
strlcpy(char *dst, const char *src, size_t siz)
{
char *d = dst;
const char *s = src;
size_t n = siz;
/* Copy as many bytes as will fit */
if(n != 0 && --n != 0)
{
do
{
if((*d++ = *s++) == 0)
break;
}
while(--n != 0);
}
/* Not enough room in dst, add NUL and traverse rest of src */
if(n == 0)
{
if(siz != 0)
*d = '\0'; /* NUL-terminate dst */
while(*s++)
;
}
return (s - src - 1); /* count does not include NUL */
}
#endif
char *
strip_colour(char *string)
{

View file

@ -388,10 +388,10 @@ initialize_global_set_options(void)
GlobalSetOptions.ident_timeout = IDENT_TIMEOUT;
strlcpy(GlobalSetOptions.operstring,
rb_strlcpy(GlobalSetOptions.operstring,
ConfigFileEntry.default_operstring,
sizeof(GlobalSetOptions.operstring));
strlcpy(GlobalSetOptions.adminstring,
rb_strlcpy(GlobalSetOptions.adminstring,
ConfigFileEntry.default_adminstring,
sizeof(GlobalSetOptions.adminstring));
@ -696,7 +696,7 @@ main(int argc, char *argv[])
ierror("no server name specified in serverinfo block.");
return -1;
}
strlcpy(me.name, ServerInfo.name, sizeof(me.name));
rb_strlcpy(me.name, ServerInfo.name, sizeof(me.name));
if(ServerInfo.sid[0] == '\0')
{
@ -712,7 +712,7 @@ main(int argc, char *argv[])
ierror("no server description specified in serverinfo block.");
return -3;
}
strlcpy(me.info, ServerInfo.description, sizeof(me.info));
rb_strlcpy(me.info, ServerInfo.description, sizeof(me.info));
if(ServerInfo.ssl_cert != NULL && ServerInfo.ssl_private_key != NULL)
{

View file

@ -457,7 +457,7 @@ add_connection(struct Listener *listener, rb_fde_t *F, struct sockaddr *sai, voi
sizeof(new_client->sockhost));
strlcpy(new_client->host, new_client->sockhost, sizeof(new_client->host));
rb_strlcpy(new_client->host, new_client->sockhost, sizeof(new_client->host));
new_client->localClient->F = F;
add_to_cli_fd_hash(new_client);

View file

@ -407,7 +407,7 @@ static void do_query_name(struct DNSQuery *query, const char *name, struct resli
{
char host_name[HOSTLEN + 1];
strlcpy(host_name, name, HOSTLEN + 1);
rb_strlcpy(host_name, name, HOSTLEN + 1);
add_local_domain(host_name, HOSTLEN);
if (request == NULL)
@ -418,7 +418,7 @@ static void do_query_name(struct DNSQuery *query, const char *name, struct resli
request->state = REQ_A;
}
strlcpy(request->queryname, host_name, sizeof(request->queryname));
rb_strlcpy(request->queryname, host_name, sizeof(request->queryname));
request->type = type;
query_name(request);
}
@ -681,7 +681,7 @@ static int proc_answer(struct reslist *request, HEADER * header, char *buf, char
else if (n == 0)
return (0); /* no more answers left */
strlcpy(request->name, hostbuf, HOSTLEN + 1);
rb_strlcpy(request->name, hostbuf, HOSTLEN + 1);
return (1);
break;
@ -866,7 +866,7 @@ void report_dns_servers(struct Client *source_p)
{
if (!inetntop_sock((struct sockaddr *)&(irc_nsaddr_list[i]),
ipaddr, sizeof ipaddr))
strlcpy(ipaddr, "?", sizeof ipaddr);
rb_strlcpy(ipaddr, "?", sizeof ipaddr);
sendto_one_numeric(source_p, RPL_STATSDEBUG,
"A %s", ipaddr);
}

View file

@ -209,7 +209,7 @@ parse_resvconf(void)
*p = '\0'; /* take the first word */
if (irccmp(opt, "domain") == 0)
strlcpy(irc_domain, arg, sizeof(irc_domain));
rb_strlcpy(irc_domain, arg, sizeof(irc_domain));
else if (irccmp(opt, "nameserver") == 0)
add_nameserver(arg);
}

View file

@ -222,7 +222,7 @@ auth_dns_callback(void *vptr, struct DNSReply *reply)
if(good && strlen(reply->h_name) <= HOSTLEN)
{
strlcpy(auth->client->host, reply->h_name, sizeof(auth->client->host));
rb_strlcpy(auth->client->host, reply->h_name, sizeof(auth->client->host));
sendheader(auth->client, REPORT_FIN_DNS);
}
else if (strlen(reply->h_name) > HOSTLEN)

View file

@ -313,7 +313,7 @@ verify_access(struct Client *client_p, const char *username)
}
else
{
strlcpy(non_ident, "~", sizeof(non_ident));
rb_strlcpy(non_ident, "~", sizeof(non_ident));
strlcat(non_ident, username, sizeof(non_ident));
aconf = find_address_conf(client_p->host, client_p->sockhost,
non_ident, client_p->username,
@ -356,14 +356,14 @@ verify_access(struct Client *client_p, const char *username)
char *host = p+1;
*p = '\0';
strlcpy(client_p->username, aconf->name,
rb_strlcpy(client_p->username, aconf->name,
sizeof(client_p->username));
strlcpy(client_p->host, host,
rb_strlcpy(client_p->host, host,
sizeof(client_p->host));
*p = '@';
}
else
strlcpy(client_p->host, aconf->name, sizeof(client_p->host));
rb_strlcpy(client_p->host, aconf->name, sizeof(client_p->host));
}
return (attach_iline(client_p, aconf));
}
@ -616,9 +616,9 @@ rehash(int sig)
read_conf_files(NO);
if(ServerInfo.description != NULL)
strlcpy(me.info, ServerInfo.description, sizeof(me.info));
rb_strlcpy(me.info, ServerInfo.description, sizeof(me.info));
else
strlcpy(me.info, "unknown", sizeof(me.info));
rb_strlcpy(me.info, "unknown", sizeof(me.info));
open_logfiles();
return (0);
@ -1162,7 +1162,7 @@ read_conf_files(int cold)
- Gozem 2002-07-21
*/
strlcpy(conffilebuf, filename, sizeof(conffilebuf));
rb_strlcpy(conffilebuf, filename, sizeof(conffilebuf));
if((conf_fbfile_in = fopen(filename, "r")) == NULL)
{

View file

@ -299,7 +299,7 @@ find_oper_conf(const char *username, const char *host, const char *locip, const
if(irccmp(oper_p->name, name) || !match(oper_p->username, username))
continue;
strlcpy(addr, oper_p->host, sizeof(addr));
rb_strlcpy(addr, oper_p->host, sizeof(addr));
if(parse_netmask(addr, (struct sockaddr *)&ip, &bits) != HM_HOST)
{
@ -755,7 +755,7 @@ add_nd_entry(const char *name)
nd = rb_bh_alloc(nd_heap);
strlcpy(nd->name, name, sizeof(nd->name));
rb_strlcpy(nd->name, name, sizeof(nd->name));
nd->expire = rb_current_time() + ConfigFileEntry.nick_delay;
/* this list is ordered */

View file

@ -1296,9 +1296,9 @@ serv_connect(struct server_conf *server_p, struct Client *by)
* The sockhost may be a hostname, this will be corrected later
* -- jilles
*/
strlcpy(client_p->name, server_p->name, sizeof(client_p->name));
strlcpy(client_p->host, server_p->host, sizeof(client_p->host));
strlcpy(client_p->sockhost, server_p->host, sizeof(client_p->sockhost));
rb_strlcpy(client_p->name, server_p->name, sizeof(client_p->name));
rb_strlcpy(client_p->host, server_p->host, sizeof(client_p->host));
rb_strlcpy(client_p->sockhost, server_p->host, sizeof(client_p->sockhost));
client_p->localClient->F = F;
add_to_cli_fd_hash(client_p);

View file

@ -293,7 +293,7 @@ register_local_user(struct Client *client_p, struct Client *source_p, const char
char note[NICKLEN + 10];
del_from_client_hash(source_p->name, source_p);
strlcpy(source_p->name, source_p->preClient->spoofnick, NICKLEN + 1);
rb_strlcpy(source_p->name, source_p->preClient->spoofnick, NICKLEN + 1);
add_to_client_hash(source_p->name, source_p);
rb_snprintf(note, NICKLEN + 10, "Nick: %s", source_p->name);
@ -304,7 +304,7 @@ register_local_user(struct Client *client_p, struct Client *source_p, const char
{
sendto_one_notice(source_p, ":*** Notice -- You have an illegal character in your hostname");
strlcpy(source_p->host, source_p->sockhost, sizeof(source_p->host));
rb_strlcpy(source_p->host, source_p->sockhost, sizeof(source_p->host));
}
@ -470,14 +470,14 @@ register_local_user(struct Client *client_p, struct Client *source_p, const char
/* end of valid user name check */
/* Store original hostname -- jilles */
strlcpy(source_p->orighost, source_p->host, HOSTLEN + 1);
rb_strlcpy(source_p->orighost, source_p->host, HOSTLEN + 1);
/* Spoof user@host */
if(*source_p->preClient->spoofuser)
strlcpy(source_p->username, source_p->preClient->spoofuser, USERLEN + 1);
rb_strlcpy(source_p->username, source_p->preClient->spoofuser, USERLEN + 1);
if(*source_p->preClient->spoofhost)
{
strlcpy(source_p->host, source_p->preClient->spoofhost, HOSTLEN + 1);
rb_strlcpy(source_p->host, source_p->preClient->spoofhost, HOSTLEN + 1);
if (irccmp(source_p->host, source_p->orighost))
SetDynSpoof(source_p);
}
@ -1437,14 +1437,14 @@ change_nick_user_host(struct Client *target_p, const char *nick, const char *use
target_p->host, nick);
}
strlcpy(target_p->username, user, sizeof target_p->username);
strlcpy(target_p->host, host, sizeof target_p->host);
rb_strlcpy(target_p->username, user, sizeof target_p->username);
rb_strlcpy(target_p->host, host, sizeof target_p->host);
if (changed)
add_history(target_p, 1);
del_from_client_hash(target_p->name, target_p);
strlcpy(target_p->name, nick, NICKLEN);
rb_strlcpy(target_p->name, nick, NICKLEN);
add_to_client_hash(target_p->name, target_p);
if(changed)

View file

@ -102,7 +102,7 @@ find_or_add(const char *name)
ptr = (struct scache_entry *) rb_malloc(sizeof(struct scache_entry));
s_assert(0 != ptr);
strlcpy(ptr->name, name, sizeof(ptr->name));
rb_strlcpy(ptr->name, name, sizeof(ptr->name));
ptr->info[0] = '\0';
ptr->flags = 0;
ptr->known_since = rb_current_time();
@ -120,7 +120,7 @@ scache_connect(const char *name, const char *info, int hidden)
struct scache_entry *ptr;
ptr = find_or_add(name);
strlcpy(ptr->info, info, sizeof(ptr->info));
rb_strlcpy(ptr->info, info, sizeof(ptr->info));
ptr->flags |= SC_ONLINE;
if (hidden)
ptr->flags |= SC_HIDDEN;

View file

@ -136,7 +136,7 @@ char *substitution_parse(const char *fmt, rb_dlink_list *varlist)
if (!strcasecmp(varname, val->name))
{
strlcpy(bptr, val->value, BUFSIZE - (bptr - buf));
rb_strlcpy(bptr, val->value, BUFSIZE - (bptr - buf));
bptr += strlen(val->value);
break;
}

View file

@ -77,7 +77,7 @@ void add_history(struct Client *client_p, int online)
* NOTE: strcpy ok here, the sizes in the client struct MUST
* match the sizes in the whowas struct
*/
strlcpy(who->name, client_p->name, sizeof(who->name));
rb_strlcpy(who->name, client_p->name, sizeof(who->name));
strcpy(who->username, client_p->username);
strcpy(who->hostname, client_p->host);
strcpy(who->realname, client_p->info);