LPWSTR __cdecl wcsncpy( LPWSTR s1, LPCWSTR s2, size_t n ) { WCHAR *ret = s1; **//When encountering 0, the loop will jump out directly, but the pointer of s1 has been++, which leads to the memory overflow of the second for** for ( ; n; n--) if (!(*s1++ = *s2++)) break; for ( ; n; n--) *s1++ = 0; return ret; }