From: Rich Felker Date: Sun, 23 Sep 2018 06:48:25 +0000 (-0400) Subject: fix undefined pointer comparison in wmemmove X-Git-Tag: v1.1.21~72 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=82c41e92320c3f84bd6d24e21c5350a06e2fc831;p=oweals%2Fmusl.git fix undefined pointer comparison in wmemmove --- diff --git a/src/string/wmemmove.c b/src/string/wmemmove.c index e406f3d5..d58cebac 100644 --- a/src/string/wmemmove.c +++ b/src/string/wmemmove.c @@ -1,9 +1,10 @@ #include +#include 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++;