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