summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2008-01-05 05:32:09 +0000
committerMike Frysinger <vapier@gentoo.org>2008-01-05 05:32:09 +0000
commit434de2bfe0a74d4efc578e4da623d4ba783e9d8a (patch)
tree0e2eafbf40c883ebb191fa04ef17630bc3b76ac3 /libc/sysdeps/linux/common
parentea5081a739a29ba397acd07c5be663f67225145b (diff)
michael_d in #1849 writes: The getcwd() implementation in the absence of a getcwd syscall has an off-by-one allocation bug. As a result, sometimes the returned string has garbage at the end.
Diffstat (limited to 'libc/sysdeps/linux/common')
-rw-r--r--libc/sysdeps/linux/common/getcwd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libc/sysdeps/linux/common/getcwd.c b/libc/sysdeps/linux/common/getcwd.c
index 165ea317e..d52792994 100644
--- a/libc/sysdeps/linux/common/getcwd.c
+++ b/libc/sysdeps/linux/common/getcwd.c
@@ -165,7 +165,7 @@ int __syscall_getcwd(char * buf, unsigned long size)
cwd = recurser(buf, size, st.st_dev, st.st_ino);
if (cwd) {
- len = strlen(buf);
+ len = strlen(buf) + 1;
__set_errno(olderrno);
}
return len;