https://git.reactos.org/?p=reactos.git;a=commitdiff;h=840dfdc3a112f2f5bb968…
commit 840dfdc3a112f2f5bb968cd8e32650fdda320b94
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Tue Sep 19 04:15:02 2023 +0300
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Fri Nov 10 19:19:22 2023 +0200
[CRT] Add parameter check to _mbscmp
Fixes crash in msvcrt_winetest::string
---
sdk/lib/crt/mbstring/mbscmp.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sdk/lib/crt/mbstring/mbscmp.c b/sdk/lib/crt/mbstring/mbscmp.c
index 611d086cc45..8f93a5fc838 100644
--- a/sdk/lib/crt/mbstring/mbscmp.c
+++ b/sdk/lib/crt/mbstring/mbscmp.c
@@ -1,10 +1,14 @@
#include <mbstring.h>
#include <string.h>
+#include <precomp.h>
/*
* @implemented
*/
int _mbscmp(const unsigned char *str1, const unsigned char *str2)
{
+ if (!MSVCRT_CHECK_PMT(str1 && str2))
+ return _NLSCMPERROR;
+
return strcmp((const char*)str1, (char*)str2);
}