Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/gen botched strncpy -> strlcpy
details: https://anonhg.NetBSD.org/src/rev/4cb1b4b234db
branches: trunk
changeset: 525742:4cb1b4b234db
user: groo <groo%NetBSD.org@localhost>
date: Tue Apr 16 19:08:43 2002 +0000
description:
botched strncpy -> strlcpy
from xs%kittenz.org@localhost
diffstat:
lib/libc/gen/getcwd.c | 6 +++---
lib/libc/gen/getpwent.c | 9 ++++-----
2 files changed, 7 insertions(+), 8 deletions(-)
diffs (57 lines):
diff -r dab4fd7947c3 -r 4cb1b4b234db lib/libc/gen/getcwd.c
--- a/lib/libc/gen/getcwd.c Tue Apr 16 19:07:57 2002 +0000
+++ b/lib/libc/gen/getcwd.c Tue Apr 16 19:08:43 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: getcwd.c,v 1.24 2000/01/22 22:19:10 mycroft Exp $ */
+/* $NetBSD: getcwd.c,v 1.25 2002/04/16 19:08:43 groo Exp $ */
/*
* Copyright (c) 1989, 1991, 1993, 1995
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)getcwd.c 8.5 (Berkeley) 2/7/95";
#else
-__RCSID("$NetBSD: getcwd.c,v 1.24 2000/01/22 22:19:10 mycroft Exp $");
+__RCSID("$NetBSD: getcwd.c,v 1.25 2002/04/16 19:08:43 groo Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -151,7 +151,7 @@
* Save the last component name and get the full pathname of
* the current directory.
*/
- (void)strncpy(wbuf, p, (sizeof(wbuf) - 1));
+ (void)strlcpy(wbuf, p, sizeof(wbuf));
/*
* Call the inernal internal version of getcwd which
diff -r dab4fd7947c3 -r 4cb1b4b234db lib/libc/gen/getpwent.c
--- a/lib/libc/gen/getpwent.c Tue Apr 16 19:07:57 2002 +0000
+++ b/lib/libc/gen/getpwent.c Tue Apr 16 19:08:43 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: getpwent.c,v 1.49 2002/02/12 18:58:04 mycroft Exp $ */
+/* $NetBSD: getpwent.c,v 1.50 2002/04/16 19:10:07 groo 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.49 2002/02/12 18:58:04 mycroft Exp $");
+__RCSID("$NetBSD: getpwent.c,v 1.50 2002/04/16 19:10:07 groo 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