diff options
Diffstat (limited to 'openbsd-compat/dirname.c')
-rw-r--r-- | openbsd-compat/dirname.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/openbsd-compat/dirname.c b/openbsd-compat/dirname.c index c29082673..a76a1dc13 100644 --- a/openbsd-compat/dirname.c +++ b/openbsd-compat/dirname.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dirname.c,v 1.4 1999/05/30 17:10:30 espie Exp $ */ | 1 | /* $OpenBSD: dirname.c,v 1.5 2001/06/27 00:58:54 lebel 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.4 1999/05/30 17:10:30 espie Exp $"; | 34 | static char rcsid[] = "$OpenBSD: dirname.c,v 1.5 2001/06/27 00:58:54 lebel 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> |
@@ -74,8 +74,7 @@ dirname(path) | |||
74 | errno = ENAMETOOLONG; | 74 | errno = ENAMETOOLONG; |
75 | return(NULL); | 75 | return(NULL); |
76 | } | 76 | } |
77 | (void)strncpy(bname, path, endp - path + 1); | 77 | strlcpy(bname, path, endp - path + 2); |
78 | bname[endp - path + 1] = '\0'; | ||
79 | return(bname); | 78 | return(bname); |
80 | } | 79 | } |
81 | #endif | 80 | #endif |