diff --git "a/sdk/lib/crt/mbstring/mbsncat.c" "b/sdk/lib/crt/mbstring/mbsncat.c" index 21e63d0c0a1..db07a83e7b5 100644 --- "a/sdk/lib/crt/mbstring/mbsncat.c" +++ "b/sdk/lib/crt/mbstring/mbsncat.c" @@ -51,7 +51,7 @@ unsigned char * _mbsnbcat(unsigned char *dst, const unsigned char *src, size_t n if (n != 0) { d = dst + _mbslen(dst); // get the end of string d += _mbclen2(*d); // move 1 or 2 up - +#if 0 do { if ((*d++ = *s++) == 0) { @@ -62,6 +62,14 @@ unsigned char * _mbsnbcat(unsigned char *dst, const unsigned char *src, size_t n if ( !(n==1 && _ismbblead(*s)) ) n--; } while (n > 0); +#endif + while (*src && n--) + { + d--; // Back up from the ending NULL + *d = *s; // Copy one character + d++; // Point to just past the copied char + *d = 0; // Put back then ending NULL + } } return dst; }