summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/realpath.c
diff options
context:
space:
mode:
authorlebel <>2001-06-27 00:58:56 +0000
committerlebel <>2001-06-27 00:58:56 +0000
commitba6f70d7550cc513151c4bb719659d4775a9efff (patch)
tree267e8c115af6744d1fab5a015c06458ba2befdab /src/lib/libc/stdlib/realpath.c
parentc18bed276b8f6877a6111a6c03185f0025220031 (diff)
downloadopenbsd-ba6f70d7550cc513151c4bb719659d4775a9efff.tar.gz
openbsd-ba6f70d7550cc513151c4bb719659d4775a9efff.tar.bz2
openbsd-ba6f70d7550cc513151c4bb719659d4775a9efff.zip
use strlcpy vs strncpy+a[len-1]='\0'. millert@ ok.
Diffstat (limited to 'src/lib/libc/stdlib/realpath.c')
-rw-r--r--src/lib/libc/stdlib/realpath.c5
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)
38static char *rcsid = "$OpenBSD: realpath.c,v 1.4 1998/05/18 09:55:19 deraadt Exp $"; 38static 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';
83loop: 82loop:
84 q = strrchr(resolved, '/'); 83 q = strrchr(resolved, '/');
85 if (q != NULL) { 84 if (q != NULL) {