summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1996-10-17 00:40:04 +0000
committerpeter <peter@FreeBSD.org>1996-10-17 00:40:04 +0000
commit283f514ba05e8e99c8f6d82d0d3a4b67078bfbb6 (patch)
treec870847492121dfb1936c72cb94e41502bb47d32
parent1fc5d71cd650d28067ae857d59ad5494b1512c4a (diff)
downloadFreeBSD-src-283f514ba05e8e99c8f6d82d0d3a4b67078bfbb6.zip
FreeBSD-src-283f514ba05e8e99c8f6d82d0d3a4b67078bfbb6.tar.gz
Corrently null-terminate the path being passed to the opendir() calls,
malloc() does is not defined to return a zeroed buffer leading to "strange" problems. Submitted by: Karl Denninger <karl@mcs.com>, PR#1826
-rw-r--r--lib/libc/gen/getcwd.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/libc/gen/getcwd.c b/lib/libc/gen/getcwd.c
index d3f5814..dfa482a 100644
--- a/lib/libc/gen/getcwd.c
+++ b/lib/libc/gen/getcwd.c
@@ -154,6 +154,7 @@ getcwd(pt, size)
/* Add trailing slash for next directory. */
*bup++ = '/';
+ *bup = '\0';
/*
* If it's a mount point, have to stat each element because
OpenPOWER on IntegriCloud