From 82c41e92320c3f84bd6d24e21c5350a06e2fc831 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sun, 23 Sep 2018 02:48:25 -0400 Subject: [PATCH] fix undefined pointer comparison in wmemmove --- src/string/wmemmove.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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++; -- 2.25.1