Utilize strlcpy().

This commit is contained in:
Xin LI 2009-02-21 03:38:46 +00:00
parent 10f99918d8
commit 1c8ee5f26c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=188886

View file

@ -113,10 +113,7 @@ get_names(int argc, char *argv[])
msg.addr.sa_family = htons(AF_INET);
msg.ctl_addr.sa_family = htons(AF_INET);
msg.id_num = htonl(0);
strncpy(msg.l_name, my_name, NAME_SIZE);
msg.l_name[NAME_SIZE - 1] = '\0';
strncpy(msg.r_name, his_name, NAME_SIZE);
msg.r_name[NAME_SIZE - 1] = '\0';
strncpy(msg.r_tty, his_tty, TTY_SIZE);
msg.r_tty[TTY_SIZE - 1] = '\0';
strlcpy(msg.l_name, my_name, NAME_SIZE);
strlcpy(msg.r_name, his_name, NAME_SIZE);
strlcpy(msg.r_tty, his_tty, TTY_SIZE);
}