Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/lib/libc/gen/getcwd.c,v retrieving revision 1.24.6.3 retrieving revision 1.25 diff -u -p -r1.24.6.3 -r1.25 --- src/lib/libc/gen/getcwd.c 2002/12/10 06:25:48 1.24.6.3 +++ src/lib/libc/gen/getcwd.c 2002/04/16 19:08:43 1.25 @@ -1,4 +1,4 @@ -/* $NetBSD: getcwd.c,v 1.24.6.3 2002/12/10 06:25:48 thorpej Exp $ */ +/* $NetBSD: getcwd.c,v 1.25 2002/04/16 19:08:43 groo Exp $ */ /* * Copyright (c) 1989, 1991, 1993, 1995 @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)getcwd.c 8.5 (Berkeley) 2/7/95"; #else -__RCSID("$NetBSD: getcwd.c,v 1.24.6.3 2002/12/10 06:25:48 thorpej Exp $"); +__RCSID("$NetBSD: getcwd.c,v 1.25 2002/04/16 19:08:43 groo Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -95,7 +95,7 @@ realpath(path, resolved) /* Save the starting point. */ if ((fd = open(".", O_RDONLY)) < 0) { - (void)strlcpy(resolved, ".", MAXPATHLEN); + (void)strcpy(resolved, "."); return (NULL); } @@ -107,7 +107,8 @@ realpath(path, resolved) * if it is a directory, then change to that directory. * get the current directory name and append the basename. */ - (void)strlcpy(resolved, path, MAXPATHLEN); + (void)strncpy(resolved, path, MAXPATHLEN - 1); + resolved[MAXPATHLEN - 1] = '\0'; loop: q = strrchr(resolved, '/'); if (q != NULL) { @@ -133,7 +134,7 @@ loop: errno = ELOOP; goto err1; } - n = readlink(p, resolved, MAXPATHLEN-1); + n = readlink(p, resolved, MAXPATHLEN); if (n < 0) goto err1; resolved[n] = '\0';