Browse Source

try to use strlcpy and snprintf more; ok various

OPENBSD_3_2
deraadt 22 years ago
parent
commit
7c4d34d5bc
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      src/lib/libc/stdlib/realpath.c

+ 3
- 3
src/lib/libc/stdlib/realpath.c View File

@ -35,7 +35,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: realpath.c,v 1.6 2002/01/12 16:24:35 millert Exp $";
static char *rcsid = "$OpenBSD: realpath.c,v 1.7 2002/05/24 21:22:37 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <sys/param.h> #include <sys/param.h>
@ -66,7 +66,7 @@ realpath(path, resolved)
/* Save the starting point. */ /* Save the starting point. */
if ((fd = open(".", O_RDONLY)) < 0) { if ((fd = open(".", O_RDONLY)) < 0) {
(void)strcpy(resolved, ".");
(void)strlcpy(resolved, ".", MAXPATHLEN);
return (NULL); return (NULL);
} }
@ -125,7 +125,7 @@ loop:
* Save the last component name and get the full pathname of * Save the last component name and get the full pathname of
* the current directory. * the current directory.
*/ */
(void)strcpy(wbuf, p);
(void)strlcpy(wbuf, p, sizeof wbuf);
if (getcwd(resolved, MAXPATHLEN) == 0) if (getcwd(resolved, MAXPATHLEN) == 0)
goto err1; goto err1;


Loading…
Cancel
Save