summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--src/system.c4
2 files changed, 4 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 63dcd87..55efaf8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -22,6 +22,7 @@
 	* Added dummy sysconf implementation.
 	* Include system.h for stpcpy in nodes.c.
 	* Added out-of-line ctypes functions for klibc.
+	* Fixed fallback stpcpy implementation.
 
 2005-10-26  Herbert Xu <herbert@gondor.apana.org.au>
 
diff --git a/src/system.c b/src/system.c
index c6bc52d..5fd6062 100644
--- a/src/system.c
+++ b/src/system.c
@@ -71,7 +71,9 @@ void *mempcpy(void *dest, const void *src, size_t n)
 #ifndef HAVE_STPCPY
 char *stpcpy(char *dest, const char *src)
 {
-	return mempcpy(dest, src, strlen(src) + 1);
+	size_t len = strlen(src);
+	dest[len] = 0;
+	return mempcpy(dest, src, len);
 }
 #endif