From 1c8ee5f26c02b001a73bcdb3673b38cbcbee012e Mon Sep 17 00:00:00 2001 From: Xin LI Date: Sat, 21 Feb 2009 03:38:46 +0000 Subject: [PATCH] Utilize strlcpy(). --- usr.bin/talk/get_names.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/usr.bin/talk/get_names.c b/usr.bin/talk/get_names.c index 25f4673b0f8..b3e0f7b661e 100644 --- a/usr.bin/talk/get_names.c +++ b/usr.bin/talk/get_names.c @@ -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); }