server: Use rb_strlcpy() instead of strcpy().

An overflow should be impossible here, but be paranoid.
This commit is contained in:
Jilles Tjoelker 2014-02-24 00:04:11 +01:00
parent 26c6ac3dc7
commit a1f7ec5be0

View file

@ -1191,7 +1191,8 @@ serv_connect(struct server_conf *server_p, struct Client *by)
make_server(client_p); make_server(client_p);
if(by && IsPerson(by)) if(by && IsPerson(by))
{ {
strcpy(client_p->serv->by, by->name); rb_strlcpy(client_p->serv->by, by->name,
sizeof client_p->serv->by);
if(client_p->serv->user) if(client_p->serv->user)
free_user(client_p->serv->user, NULL); free_user(client_p->serv->user, NULL);
client_p->serv->user = by->user; client_p->serv->user = by->user;
@ -1199,7 +1200,8 @@ serv_connect(struct server_conf *server_p, struct Client *by)
} }
else else
{ {
strcpy(client_p->serv->by, "AutoConn."); rb_strlcpy(client_p->serv->by, "AutoConn.",
sizeof client_p->serv->by);
if(client_p->serv->user) if(client_p->serv->user)
free_user(client_p->serv->user, NULL); free_user(client_p->serv->user, NULL);
client_p->serv->user = NULL; client_p->serv->user = NULL;