Module Name:    src
Committed By:   mrg
Date:           Mon Apr 12 09:29:53 UTC 2021

Modified Files:
        src/usr.sbin/ac: ac.c

Log Message:
use strlcpy() to ensure desired nul termination.
trailing nul bytes are not needed here.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/ac/ac.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/ac/ac.c
diff -u src/usr.sbin/ac/ac.c:1.25 src/usr.sbin/ac/ac.c:1.26
--- src/usr.sbin/ac/ac.c:1.25	Fri Aug 31 19:55:23 2012
+++ src/usr.sbin/ac/ac.c	Mon Apr 12 09:29:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ac.c,v 1.25 2012/08/31 19:55:23 wiz Exp $ */
+/* $NetBSD: ac.c,v 1.26 2021/04/12 09:29:53 mrg Exp $ */
 
 /*-
  * Copyright (c) 1994 Christopher G. Demetriou
@@ -29,7 +29,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: ac.c,v 1.25 2012/08/31 19:55:23 wiz Exp $");
+__RCSID("$NetBSD: ac.c,v 1.26 2021/04/12 09:29:53 mrg Exp $");
 #endif
 
 #include <sys/types.h>
@@ -214,7 +214,7 @@ find_login_ttys(void)
 				Con = nCon;
 				Maxcon += 10;
 			}
-			(void)strncpy(Con[Ncon++], tty->ty_name, UT_LINESIZE);
+			strlcpy(Con[Ncon++], tty->ty_name, UT_LINESIZE);
 		}
 	endttyent();
 	qsort(Con, Ncon, sizeof(Con[0]), compare);

Reply via email to