diff options
Diffstat (limited to 'openbsd-compat/dirname.c')
-rw-r--r-- | openbsd-compat/dirname.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/openbsd-compat/dirname.c b/openbsd-compat/dirname.c index 391b2dd81..35c7d8ec7 100644 --- a/openbsd-compat/dirname.c +++ b/openbsd-compat/dirname.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dirname.c,v 1.6 2001/06/28 04:27:19 pjanzen Exp $ */ | 1 | /* $OpenBSD: dirname.c,v 1.7 2002/05/24 21:22:37 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com> | 4 | * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com> |
@@ -31,7 +31,7 @@ | |||
31 | #ifndef HAVE_DIRNAME | 31 | #ifndef HAVE_DIRNAME |
32 | 32 | ||
33 | #if defined(LIBC_SCCS) && !defined(lint) | 33 | #if defined(LIBC_SCCS) && !defined(lint) |
34 | static char rcsid[] = "$OpenBSD: dirname.c,v 1.6 2001/06/28 04:27:19 pjanzen Exp $"; | 34 | static char rcsid[] = "$OpenBSD: dirname.c,v 1.7 2002/05/24 21:22:37 deraadt Exp $"; |
35 | #endif /* LIBC_SCCS and not lint */ | 35 | #endif /* LIBC_SCCS and not lint */ |
36 | 36 | ||
37 | #include <errno.h> | 37 | #include <errno.h> |
@@ -47,7 +47,7 @@ dirname(path) | |||
47 | 47 | ||
48 | /* Empty or NULL string gets treated as "." */ | 48 | /* Empty or NULL string gets treated as "." */ |
49 | if (path == NULL || *path == '\0') { | 49 | if (path == NULL || *path == '\0') { |
50 | (void)strcpy(bname, "."); | 50 | (void)strlcpy(bname, ".", sizeof bname); |
51 | return(bname); | 51 | return(bname); |
52 | } | 52 | } |
53 | 53 | ||
@@ -62,7 +62,7 @@ dirname(path) | |||
62 | 62 | ||
63 | /* Either the dir is "/" or there are no slashes */ | 63 | /* Either the dir is "/" or there are no slashes */ |
64 | if (endp == path) { | 64 | if (endp == path) { |
65 | (void)strcpy(bname, *endp == '/' ? "/" : "."); | 65 | (void)strlcpy(bname, *endp == '/' ? "/" : ".", sizeof bname); |
66 | return(bname); | 66 | return(bname); |
67 | } else { | 67 | } else { |
68 | do { | 68 | do { |