summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libc/string/string.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libc/string/string.c b/libc/string/string.c
index 4a367b561..d8b8e9f37 100644
--- a/libc/string/string.c
+++ b/libc/string/string.c
@@ -38,7 +38,15 @@ size_t strnlen (const char *string, size_t maxlen)
#ifdef L_strcat
char *strcat(char *dst, const char *src)
{
- strcpy(dst + strlen(dst), src);
+ register char *ptr = dst;
+
+ while (*ptr)
+ ptr++;
+
+ while (*src)
+ *ptr++ = *src++;
+ *ptr = '\0';
+
return dst;
}
#endif