From a5570fb5a13b49eaf6f7b3db3d9341b596fdfc38 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Sat, 29 Oct 2005 23:48:05 +1000 Subject: [SYSTEM] Fixed fallback stpcpy implementation The implementation has an off-by-one bug. This results in random memory corruption. In one particular case, it caused certain bits of a function body to go missing. --- src/system.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') 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 -- cgit 1.4.1