diff options
Diffstat (limited to 'openbsd-compat/realpath.c')
-rw-r--r-- | openbsd-compat/realpath.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/openbsd-compat/realpath.c b/openbsd-compat/realpath.c index fbe2a9c2c..ec801d498 100644 --- a/openbsd-compat/realpath.c +++ b/openbsd-compat/realpath.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #if !defined(HAVE_REALPATH) || defined(BROKEN_REALPATH) | 32 | #if !defined(HAVE_REALPATH) || defined(BROKEN_REALPATH) |
33 | 33 | ||
34 | #if defined(LIBC_SCCS) && !defined(lint) | 34 | #if defined(LIBC_SCCS) && !defined(lint) |
35 | static char *rcsid = "$OpenBSD: realpath..c,v 1.4 1998/05/18 09:55:19 deraadt Exp $"; | 35 | static char *rcsid = "$OpenBSD: realpath.c,v 1.5 2001/06/27 00:58:56 lebel Exp $"; |
36 | #endif /* LIBC_SCCS and not lint */ | 36 | #endif /* LIBC_SCCS and not lint */ |
37 | 37 | ||
38 | #include <sys/param.h> | 38 | #include <sys/param.h> |
@@ -82,8 +82,7 @@ realpath(const char *path, char *resolved) | |||
82 | * if it is a directory, then change to that directory. | 82 | * if it is a directory, then change to that directory. |
83 | * get the current directory name and append the basename. | 83 | * get the current directory name and append the basename. |
84 | */ | 84 | */ |
85 | (void)strncpy(resolved, path, MAXPATHLEN - 1); | 85 | strlcpy(resolved, path, MAXPATHLEN); |
86 | resolved[MAXPATHLEN - 1] = '\0'; | ||
87 | loop: | 86 | loop: |
88 | q = strrchr(resolved, '/'); | 87 | q = strrchr(resolved, '/'); |
89 | if (q != NULL) { | 88 | if (q != NULL) { |