strcpy: mass-migrate to strlcpy where appropriate
This commit is contained in:
parent
02ca4405a0
commit
4d5a902f08
13 changed files with 25 additions and 25 deletions
|
@ -247,7 +247,7 @@ make_client(struct Client *from)
|
|||
}
|
||||
|
||||
SetUnknown(client_p);
|
||||
strcpy(client_p->username, "unknown");
|
||||
rb_strlcpy(client_p->username, "unknown", sizeof(client_p->username));
|
||||
|
||||
return client_p;
|
||||
}
|
||||
|
|
|
@ -815,7 +815,7 @@ charybdis_main(int argc, char * const argv[])
|
|||
ierror("no server sid specified in serverinfo block.");
|
||||
return -2;
|
||||
}
|
||||
strcpy(me.id, ServerInfo.sid);
|
||||
rb_strlcpy(me.id, ServerInfo.sid, sizeof(me.id));
|
||||
init_uid();
|
||||
|
||||
/* serverinfo{} description must exist. If not, error out. */
|
||||
|
|
|
@ -358,8 +358,8 @@ int match_ips(const char *s1, const char *s2)
|
|||
void *ipptr, *maskptr;
|
||||
int cidrlen, aftype;
|
||||
|
||||
strcpy(mask, s1);
|
||||
strcpy(address, s2);
|
||||
rb_strlcpy(mask, s1, sizeof(mask));
|
||||
rb_strlcpy(address, s2, sizeof(address));
|
||||
|
||||
len = strrchr(mask, '/');
|
||||
if (len == NULL)
|
||||
|
@ -422,8 +422,8 @@ int match_cidr(const char *s1, const char *s2)
|
|||
void *ipptr, *maskptr;
|
||||
int cidrlen, aftype;
|
||||
|
||||
strcpy(mask, s1);
|
||||
strcpy(address, s2);
|
||||
rb_strlcpy(mask, s1, sizeof(mask));
|
||||
rb_strlcpy(address, s2, sizeof(address));
|
||||
|
||||
ipmask = strrchr(mask, '@');
|
||||
if (ipmask == NULL)
|
||||
|
|
|
@ -225,7 +225,7 @@ conf_set_serverinfo_sid(void *data)
|
|||
return;
|
||||
}
|
||||
|
||||
strcpy(ServerInfo.sid, sid);
|
||||
rb_strlcpy(ServerInfo.sid, sid, sizeof(ServerInfo.sid));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1132,7 +1132,7 @@ serv_connect(struct server_conf *server_p, struct Client *by)
|
|||
*/
|
||||
make_server(client_p);
|
||||
if(by && IsClient(by))
|
||||
strcpy(client_p->serv->by, by->name);
|
||||
rb_strlcpy(client_p->serv->by, by->name, sizeof(client_p->serv->by));
|
||||
else
|
||||
strcpy(client_p->serv->by, "AutoConn.");
|
||||
|
||||
|
|
|
@ -621,7 +621,7 @@ register_local_user(struct Client *client_p, struct Client *source_p)
|
|||
*/
|
||||
if(!*source_p->id)
|
||||
{
|
||||
strcpy(source_p->id, generate_uid());
|
||||
rb_strlcpy(source_p->id, generate_uid(), sizeof(source_p->id));
|
||||
add_to_id_hash(source_p->id, source_p);
|
||||
}
|
||||
|
||||
|
|
|
@ -524,7 +524,7 @@ ssl_process_certfp(ssl_ctl_t * ctl, ssl_ctl_buf_t * ctl_buf)
|
|||
|
||||
rb_free(client_p->certfp);
|
||||
certfp_string = rb_malloc(method_len + len * 2 + 1);
|
||||
strcpy(certfp_string, method_string);
|
||||
rb_strlcpy(certfp_string, method_string, method_len + len * 2 + 1);
|
||||
for(uint32_t i = 0; i < len; i++)
|
||||
snprintf(certfp_string + method_len + 2 * i, 3, "%02x",
|
||||
certfp[i]);
|
||||
|
|
|
@ -179,7 +179,7 @@ m_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
|
|||
/* join 0 parts all channels */
|
||||
if(*name == '0' && (name[1] == ',' || name[1] == '\0') && name == chanlist)
|
||||
{
|
||||
(void) strcpy(jbuf, "0");
|
||||
rb_strlcpy(jbuf, "0", sizeof(jbuf));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -687,7 +687,7 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
if(oldmode->limit > mode.limit)
|
||||
mode.limit = oldmode->limit;
|
||||
if(strcmp(mode.key, oldmode->key) < 0)
|
||||
strcpy(mode.key, oldmode->key);
|
||||
rb_strlcpy(mode.key, oldmode->key, sizeof(mode.key));
|
||||
if(oldmode->join_num > mode.join_num ||
|
||||
(oldmode->join_num == mode.join_num &&
|
||||
oldmode->join_time > mode.join_time))
|
||||
|
@ -696,7 +696,7 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
mode.join_time = oldmode->join_time;
|
||||
}
|
||||
if(irccmp(mode.forward, oldmode->forward) < 0)
|
||||
strcpy(mode.forward, oldmode->forward);
|
||||
rb_strlcpy(mode.forward, oldmode->forward, sizeof(mode.forward));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -155,7 +155,7 @@ mr_nick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
if((target_p = find_named_client(nick)) == NULL)
|
||||
set_initial_nick(client_p, source_p, nick);
|
||||
else if(source_p == target_p)
|
||||
strcpy(source_p->name, nick);
|
||||
rb_strlcpy(source_p->name, nick, sizeof(source_p->name));
|
||||
else
|
||||
sendto_one(source_p, form_str(ERR_NICKNAMEINUSE), me.name, "*", nick);
|
||||
}
|
||||
|
@ -593,7 +593,7 @@ set_initial_nick(struct Client *client_p, struct Client *source_p, char *nick)
|
|||
if(source_p->name[0])
|
||||
del_from_client_hash(source_p->name, source_p);
|
||||
|
||||
strcpy(source_p->name, nick);
|
||||
rb_strlcpy(source_p->name, nick, sizeof(source_p->name));
|
||||
add_to_client_hash(nick, source_p);
|
||||
|
||||
snprintf(note, sizeof(note), "Nick: %s", nick);
|
||||
|
@ -680,7 +680,7 @@ change_local_nick(struct Client *client_p, struct Client *source_p,
|
|||
|
||||
/* Finally, add to hash */
|
||||
del_from_client_hash(source_p->name, source_p);
|
||||
strcpy(source_p->name, nick);
|
||||
rb_strlcpy(source_p->name, nick, sizeof(source_p->name));
|
||||
add_to_client_hash(nick, source_p);
|
||||
|
||||
if(!samenick)
|
||||
|
@ -743,7 +743,7 @@ change_remote_nick(struct Client *client_p, struct Client *source_p,
|
|||
if((nd = rb_dictionary_retrieve(nd_dict, nick)))
|
||||
free_nd_entry(nd);
|
||||
|
||||
strcpy(source_p->name, nick);
|
||||
rb_strlcpy(source_p->name, nick, sizeof(source_p->name));
|
||||
add_to_client_hash(nick, source_p);
|
||||
|
||||
if(!samenick)
|
||||
|
@ -1023,7 +1023,7 @@ register_client(struct Client *client_p, struct Client *server,
|
|||
source_p->hopcount = atoi(parv[2]);
|
||||
source_p->tsinfo = newts;
|
||||
|
||||
strcpy(source_p->name, nick);
|
||||
rb_strlcpy(source_p->name, nick, sizeof(source_p->name));
|
||||
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));
|
||||
|
|
|
@ -636,7 +636,7 @@ ms_sid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
|
|||
|
||||
rb_strlcpy(target_p->name, parv[1], sizeof(target_p->name));
|
||||
target_p->hopcount = atoi(parv[2]);
|
||||
strcpy(target_p->id, parv[3]);
|
||||
rb_strlcpy(target_p->id, parv[3], sizeof(target_p->id));
|
||||
set_server_gecos(target_p, parv[4]);
|
||||
|
||||
target_p->servptr = source_p;
|
||||
|
|
|
@ -104,7 +104,7 @@ mr_pass(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
EmptyString(client_p->id))
|
||||
{
|
||||
client_p->localClient->caps |= CAP_TS6;
|
||||
strcpy(client_p->id, parv[4]);
|
||||
rb_strlcpy(client_p->id, parv[4], sizeof(client_p->id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -165,7 +165,7 @@ m_authenticate(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *
|
|||
if(!*source_p->id)
|
||||
{
|
||||
/* Allocate a UID. */
|
||||
strcpy(source_p->id, generate_uid());
|
||||
rb_strlcpy(source_p->id, generate_uid(), sizeof(source_p->id));
|
||||
add_to_id_hash(source_p->id, source_p);
|
||||
}
|
||||
|
||||
|
|
|
@ -221,13 +221,13 @@ me_svslogin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
|
|||
struct User *user_p = make_user(target_p);
|
||||
|
||||
if(valid & NICK_VALID)
|
||||
strcpy(target_p->preClient->spoofnick, nick);
|
||||
rb_strlcpy(target_p->preClient->spoofnick, nick, sizeof(target_p->preClient->spoofnick));
|
||||
|
||||
if(valid & USER_VALID)
|
||||
strcpy(target_p->preClient->spoofuser, user);
|
||||
rb_strlcpy(target_p->preClient->spoofuser, user, sizeof(target_p->preClient->spoofuser));
|
||||
|
||||
if(valid & HOST_VALID)
|
||||
strcpy(target_p->preClient->spoofhost, host);
|
||||
rb_strlcpy(target_p->preClient->spoofhost, host, sizeof(target_p->preClient->spoofhost));
|
||||
|
||||
rb_strlcpy(user_p->suser, login, NICKLEN + 1);
|
||||
}
|
||||
|
@ -410,7 +410,7 @@ send_signon(struct Client *client_p, struct Client *target_p,
|
|||
use_id(target_p), nick, user, host,
|
||||
(long) target_p->tsinfo, *login ? login : "0");
|
||||
|
||||
strcpy(target_p->user->suser, login);
|
||||
rb_strlcpy(target_p->user->suser, login, sizeof(target_p->user->suser));
|
||||
|
||||
change_nick_user_host(target_p, nick, user, host, newts, "Signing %s (%s)", *login ? "in" : "out", nick);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue