https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d4993c67cd8e9bb724ceeā¦
commit d4993c67cd8e9bb724ceeb26e0b252273c8184e1
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Tue Sep 19 18:32:00 2023 +0300
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Fri Nov 10 19:19:22 2023 +0200
[CRT] Fix parameter check for _memicmp on NT 6+
Fixes a crash in msvcrt_winetest:string
---
sdk/lib/crt/mem/memicmp.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/sdk/lib/crt/mem/memicmp.c b/sdk/lib/crt/mem/memicmp.c
index b98608b3242..e99d9b2a2a2 100644
--- a/sdk/lib/crt/mem/memicmp.c
+++ b/sdk/lib/crt/mem/memicmp.c
@@ -8,6 +8,19 @@ int
CDECL
_memicmp(const void *s1, const void *s2, size_t n)
{
+ if (NtCurrentPeb()->OSMajorVersion >= 6)
+ {
+ if (!s1 || !s2)
+ {
+ if (n != 0)
+ {
+ MSVCRT_INVALID_PMT(NULL, EINVAL);
+ return _NLSCMPERROR;
+ }
+ return 0;
+ }
+ }
+
if (n != 0)
{
const unsigned char *p1 = s1, *p2 = s2;