summaryrefslogtreecommitdiff
path: root/bin/ls/ls.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2003-04-02 19:43:53 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2003-04-02 19:43:53 +0000
commit5f7f909d0d711c7df3d69ed4e7ca26744720340d (patch)
treec99c6a3fb44257774752537b29d9db365c310303 /bin/ls/ls.c
parent530363072a62a5e606ef0bbf54711a8ba7c7ba4d (diff)
strlcpy; millert ok
Diffstat (limited to 'bin/ls/ls.c')
-rw-r--r--bin/ls/ls.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/bin/ls/ls.c b/bin/ls/ls.c
index 00c03b22091..679de192176 100644
--- a/bin/ls/ls.c
+++ b/bin/ls/ls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ls.c,v 1.17 2002/03/12 01:05:15 millert Exp $ */
+/* $OpenBSD: ls.c,v 1.18 2003/04/02 19:43:52 deraadt Exp $ */
/* $NetBSD: ls.c,v 1.18 1996/07/09 09:16:29 mycroft Exp $ */
/*
@@ -47,7 +47,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)ls.c 8.7 (Berkeley) 8/5/94";
#else
-static char rcsid[] = "$OpenBSD: ls.c,v 1.17 2002/03/12 01:05:15 millert Exp $";
+static char rcsid[] = "$OpenBSD: ls.c,v 1.18 2003/04/02 19:43:52 deraadt Exp $";
#endif
#endif /* not lint */
@@ -503,21 +503,21 @@ display(p, list)
flen = 0;
if ((np = malloc(sizeof(NAMES) +
- ulen + glen + flen + 3)) == NULL)
+ ulen + 1 + glen + 1 + flen + 1)) == NULL)
err(1, NULL);
np->user = &np->data[0];
- (void)strcpy(np->user, user);
+ (void)strlcpy(np->user, user, ulen + 1);
np->group = &np->data[ulen + 1];
- (void)strcpy(np->group, group);
+ (void)strlcpy(np->group, group, glen + 1);
if (S_ISCHR(sp->st_mode) ||
S_ISBLK(sp->st_mode))
bcfile = 1;
if (f_flags) {
- np->flags = &np->data[ulen + glen + 2];
- (void)strcpy(np->flags, flags);
+ np->flags = &np->data[ulen + 1 + glen + 1];
+ (void)strlcpy(np->flags, flags, flen + 1);
if (*flags != '-')
free(flags);
}