Alex Henrie alexhenrie24@gmail.com wrote:
+static inline wchar_t* __cdecl wmemmove(wchar_t *dst, const wchar_t
*src, size_t n)
+{
- size_t i;
- if (dst <= src) return wmemcpy(dst, src, n);
- for (i = 1; i <= n; i++)
dst[n - i] = src[n - i];
- return dst;
+}
The optimization with wmemcpy() looks arbitrary and not safe.
It looks perfectly safe to me. Can you give an example of valid inputs that would cause memory corruption?
When the buffers overlap each other with 1 byte offset.