diff --git a/userspace/libraries/LibC/string.cpp b/userspace/libraries/LibC/string.cpp index 0117f308..b15b711a 100644 --- a/userspace/libraries/LibC/string.cpp +++ b/userspace/libraries/LibC/string.cpp @@ -147,7 +147,10 @@ char* strcat(char* __restrict__ dest, const char* __restrict__ src) char* strncat(char* __restrict__ dest, const char* __restrict__ src, size_t n) { - strncpy(dest + strlen(dest), src, n); + dest += strlen(dest); + while (*src && n--) + *dest++ = *src++; + *dest = '\0'; return dest; }