about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2023-04-24 11:21:13 -0400
committerRich Felker <dalias@aerifal.cx>2023-04-24 11:23:39 -0400
commitb928c7234f62c35a9b4927586ff4c3cbf6e513b5 (patch)
tree7cd3592b16d20d613c273bd6f52ff2b1e7fdb66c /src
parent4724793f96b163e95cb15e1b7374ff2b0434ed15 (diff)
downloadmusl-b928c7234f62c35a9b4927586ff4c3cbf6e513b5.tar.gz
musl-b928c7234f62c35a9b4927586ff4c3cbf6e513b5.tar.xz
musl-b928c7234f62c35a9b4927586ff4c3cbf6e513b5.zip
fix return value of wmemcmp for extreme wchar_t values
analogous to the bug in wcscmp and wcsncmp that was fixed in commit
07616721f1fa6cb215ffbef23441cae80412484f.
Diffstat (limited to 'src')
-rw-r--r--src/string/wmemcmp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/string/wmemcmp.c b/src/string/wmemcmp.c
index 2a193263..717d77b1 100644
--- a/src/string/wmemcmp.c
+++ b/src/string/wmemcmp.c
@@ -3,5 +3,5 @@
 int wmemcmp(const wchar_t *l, const wchar_t *r, size_t n)
 {
 	for (; n && *l==*r; n--, l++, r++);
-	return n ? *l-*r : 0;
+	return n ? (*l < *r ? -1 : *l > *r) : 0;
 }