Source-Changes-HG archive

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

[src/netbsd-1-5]: src/lib/libc/gen Pull up revision 1.50 (requested by groo):



details:   https://anonhg.NetBSD.org/src/rev/aff31a42ba2a
branches:  netbsd-1-5
changeset: 493063:aff31a42ba2a
user:      he <he%NetBSD.org@localhost>
date:      Wed Apr 17 11:46:02 2002 +0000

description:
Pull up revision 1.50 (requested by groo):
  Replace an instance of erroneous usage of strncpy() with strlcpy().

diffstat:

 lib/libc/gen/getpwent.c |  9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diffs (30 lines):

diff -r 0456ec34cfbd -r aff31a42ba2a lib/libc/gen/getpwent.c
--- a/lib/libc/gen/getpwent.c   Wed Apr 17 11:45:21 2002 +0000
+++ b/lib/libc/gen/getpwent.c   Wed Apr 17 11:46:02 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getpwent.c,v 1.46.4.3 2002/04/17 11:45:21 he Exp $     */
+/*     $NetBSD: getpwent.c,v 1.46.4.4 2002/04/17 11:46:02 he Exp $     */
 
 /*
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)getpwent.c 8.2 (Berkeley) 4/27/95";
 #else
-__RCSID("$NetBSD: getpwent.c,v 1.46.4.3 2002/04/17 11:45:21 he Exp $");
+__RCSID("$NetBSD: getpwent.c,v 1.46.4.4 2002/04/17 11:46:02 he Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -376,9 +376,8 @@
 
                if (yp_match(__ypdomain, "passwd.adjunct.byname", pw->pw_name,
                    (int)strlen(pw->pw_name), &data, &datalen) == 0) {
-                       if (datalen > sizeof(adjunctpw) - 1)
-                               datalen = sizeof(adjunctpw) - 1;
-                       strncpy(adjunctpw, data, (size_t)datalen);
+                       strlcpy(adjunctpw, data, MIN((size_t)datalen,
+                           sizeof(adjunctpw)));
 
                                /* skip name to get password */
                        if ((bp = strsep(&data, ":")) != NULL &&



Home | Main Index | Thread Index | Old Index