Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/ac use strlcpy() to ensure desired nul termination.



details:   https://anonhg.NetBSD.org/src/rev/e48de752d790
branches:  trunk
changeset: 378411:e48de752d790
user:      mrg <mrg%NetBSD.org@localhost>
date:      Mon Apr 12 09:29:53 2021 +0000

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

diffstat:

 usr.sbin/ac/ac.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r cbad758299ec -r e48de752d790 usr.sbin/ac/ac.c
--- a/usr.sbin/ac/ac.c  Mon Apr 12 09:24:24 2021 +0000
+++ b/usr.sbin/ac/ac.c  Mon Apr 12 09:29:53 2021 +0000
@@ -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);



Home | Main Index | Thread Index | Old Index