svn commit: trunk/uClibc/libc/sysdeps/linux/common

vapier at uclibc.org vapier at uclibc.org
Fri Jan 4 21:32:10 PST 2008


Author: vapier
Date: 2008-01-04 21:32:09 -0800 (Fri, 04 Jan 2008)
New Revision: 20711

Log:
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.


Modified:
   trunk/uClibc/libc/sysdeps/linux/common/getcwd.c


Changeset:
Modified: trunk/uClibc/libc/sysdeps/linux/common/getcwd.c
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/common/getcwd.c	2008-01-05 03:26:41 UTC (rev 20710)
+++ trunk/uClibc/libc/sysdeps/linux/common/getcwd.c	2008-01-05 05:32:09 UTC (rev 20711)
@@ -165,7 +165,7 @@
 
     cwd = recurser(buf, size, st.st_dev, st.st_ino);
     if (cwd) {
-	len = strlen(buf);
+	len = strlen(buf) + 1;
 	__set_errno(olderrno);
     }
     return len;



More information about the uClibc-cvs mailing list