summaryrefslogtreecommitdiffstats
path: root/openbsd-compat/dirname.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2002-09-11 10:29:11 +1000
committerDamien Miller <djm@mindrot.org>2002-09-11 10:29:11 +1000
commit71eb0c1550ec6ad10d29779df7a7f97c44000e3a (patch)
tree1cbfd081547bcf3bfcc26e17f2f4537a03ced5ff /openbsd-compat/dirname.c
parentc34e03e4711cabffae3504bcfdac26b67250c45d (diff)
- (djm) Sync openbsd-compat with OpenBSD -current
Diffstat (limited to 'openbsd-compat/dirname.c')
-rw-r--r--openbsd-compat/dirname.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/openbsd-compat/dirname.c b/openbsd-compat/dirname.c
index 391b2dd8..35c7d8ec 100644
--- a/openbsd-compat/dirname.c
+++ b/openbsd-compat/dirname.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dirname.c,v 1.6 2001/06/28 04:27:19 pjanzen Exp $ */
+/* $OpenBSD: dirname.c,v 1.7 2002/05/24 21:22:37 deraadt Exp $ */
/*
* Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -31,7 +31,7 @@
#ifndef HAVE_DIRNAME
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: dirname.c,v 1.6 2001/06/28 04:27:19 pjanzen Exp $";
+static char rcsid[] = "$OpenBSD: dirname.c,v 1.7 2002/05/24 21:22:37 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <errno.h>
@@ -47,7 +47,7 @@ dirname(path)
/* Empty or NULL string gets treated as "." */
if (path == NULL || *path == '\0') {
- (void)strcpy(bname, ".");
+ (void)strlcpy(bname, ".", sizeof bname);
return(bname);
}
@@ -62,7 +62,7 @@ dirname(path)
/* Either the dir is "/" or there are no slashes */
if (endp == path) {
- (void)strcpy(bname, *endp == '/' ? "/" : ".");
+ (void)strlcpy(bname, *endp == '/' ? "/" : ".", sizeof bname);
return(bname);
} else {
do {