fix undefined pointer comparison in wmemmove

This commit is contained in:
Rich Felker committed 2018-09-23 02:48:25 -04:00
1 parent debadaa238
commit 82c41e9232
1 file changed
+2 -1
+2 -1
View File
@@ -1,9 +1,10 @@
#include <wchar.h>
#include <stdint.h>
wchar_t *wmemmove(wchar_t *d, const wchar_t *s, size_t n)
{
wchar_t *d0 = d;
if ((size_t)(d-s) < n)
if ((uintptr_t)d-(uintptr_t)s < n * sizeof *d)
while (n--) d[n] = s[n];
else
while (n--) *d++ = *s++;