strlcpy
This commit is contained in:
parent
c0970755a6
commit
28f506f3a2
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: function.c,v 1.43 2003/01/30 10:49:05 jhawk Exp $ */
|
||||
/* $NetBSD: function.c,v 1.44 2003/07/12 13:57:49 itojun Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
@ -41,7 +41,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "from: @(#)function.c 8.10 (Berkeley) 5/4/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: function.c,v 1.43 2003/01/30 10:49:05 jhawk Exp $");
|
||||
__RCSID("$NetBSD: function.c,v 1.44 2003/07/12 13:57:49 itojun Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -765,7 +765,7 @@ f_fstype(plan, entry)
|
||||
* always copy both of them.
|
||||
*/
|
||||
val = sb.f_flags;
|
||||
strncpy(fstype, sb.f_fstypename, MFSNAMELEN);
|
||||
strlcpy(fstype, sb.f_fstypename, sizeof(fstype));
|
||||
}
|
||||
switch (plan->flags) {
|
||||
case F_MTFLAG:
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ls.c,v 1.16 2002/10/19 20:33:19 provos Exp $ */
|
||||
/* $NetBSD: ls.c,v 1.17 2003/07/12 13:57:50 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "from: @(#)ls.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: ls.c,v 1.16 2002/10/19 20:33:19 provos Exp $");
|
||||
__RCSID("$NetBSD: ls.c,v 1.17 2003/07/12 13:57:50 itojun Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -121,7 +121,7 @@ printlink(name)
|
||||
int lnklen;
|
||||
char path[MAXPATHLEN + 1];
|
||||
|
||||
if ((lnklen = readlink(name, path, MAXPATHLEN - 1)) == -1) {
|
||||
if ((lnklen = readlink(name, path, sizeof(path) - 1)) == -1) {
|
||||
warn("%s", name);
|
||||
return;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: w.c,v 1.58 2003/02/26 19:10:28 christos Exp $ */
|
||||
/* $NetBSD: w.c,v 1.59 2003/07/12 14:05:10 itojun Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1991, 1993, 1994
|
||||
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1991, 1993, 1994\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)w.c 8.6 (Berkeley) 6/30/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: w.c,v 1.58 2003/02/26 19:10:28 christos Exp $");
|
||||
__RCSID("$NetBSD: w.c,v 1.59 2003/07/12 14:05:10 itojun Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -378,8 +378,7 @@ main(int argc, char **argv)
|
||||
for (ep = ehead; ep != NULL; ep = ep->next) {
|
||||
char host_buf[MAXHOSTNAMELEN + 1];
|
||||
|
||||
host_buf[MAXHOSTNAMELEN] = '\0';
|
||||
strncpy(host_buf, ep->host, MAXHOSTNAMELEN);
|
||||
strlcpy(host_buf, ep->host, sizeof(host_buf));
|
||||
p = *host_buf ? host_buf : "-";
|
||||
|
||||
for (x = p; x < p + MAXHOSTNAMELEN; x++)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ypwhich.c,v 1.12 2002/06/11 06:06:21 itojun Exp $ */
|
||||
/* $NetBSD: ypwhich.c,v 1.13 2003/07/12 14:03:46 itojun Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -363,7 +363,7 @@ find_mapmaster(host, domain, map, inhibit, force)
|
||||
* asked about in it.
|
||||
*/
|
||||
memset(&fakelist, 0, sizeof(fakelist));
|
||||
strncpy(fakelist.ypml_name, map, YPMAXMAP);
|
||||
strlcpy(fakelist.ypml_name, map, sizeof(fakelist.ypml_name));
|
||||
fakelist.ypml_next = NULL;
|
||||
ypml = &fakelist;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user