[PATCH 2/2] msvcrt: Check pmode in _wsopen_dispatch.
Lauri Kenttä
lauri.kentta at gmail.com
Sat Feb 4 08:38:03 CST 2017
Signed-off-by: Lauri Kenttä <lauri.kentta at gmail.com>
---
dlls/msvcrt/file.c | 4 ++--
dlls/ucrtbase/tests/misc.c | 4 ----
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c
index b5aa20b548..e9c729b7db 100644
--- a/dlls/msvcrt/file.c
+++ b/dlls/msvcrt/file.c
@@ -2171,8 +2171,8 @@ int CDECL MSVCRT__wsopen_dispatch( const MSVCRT_wchar_t* path, int oflags, int s
if (oflags & MSVCRT__O_CREAT)
{
- if(pmode & ~(MSVCRT__S_IREAD | MSVCRT__S_IWRITE))
- FIXME(": pmode 0x%04x ignored\n", pmode);
+ if (secure && !MSVCRT_CHECK_PMT(!(pmode & ~(MSVCRT__S_IREAD | MSVCRT__S_IWRITE))))
+ return MSVCRT_EINVAL;
if (oflags & MSVCRT__O_EXCL)
creation = CREATE_NEW;
diff --git a/dlls/ucrtbase/tests/misc.c b/dlls/ucrtbase/tests/misc.c
index cc820224de..d8075ccddb 100644
--- a/dlls/ucrtbase/tests/misc.c
+++ b/dlls/ucrtbase/tests/misc.c
@@ -396,11 +396,9 @@ static void test__sopen_dispatch(void)
SET_EXPECT(global_invalid_parameter_handler);
fd = 0;
ret = p_sopen_dispatch(tempf, _O_CREAT, _SH_DENYWR, 0xff, &fd, 1);
-todo_wine {
ok(ret == EINVAL, "got %d\n", ret);
ok(fd == -1, "got fd %d\n", fd);
CHECK_CALLED(global_invalid_parameter_handler);
-}
if (fd > 0)
{
_close(fd);
@@ -438,11 +436,9 @@ static void test__sopen_s(void)
SET_EXPECT(global_invalid_parameter_handler);
fd = 0;
ret = p_sopen_s(&fd, tempf, _O_CREAT, _SH_DENYWR, 0xff);
-todo_wine {
ok(ret == EINVAL, "got %d\n", ret);
ok(fd == -1, "got fd %d\n", fd);
CHECK_CALLED(global_invalid_parameter_handler);
-}
p__set_invalid_parameter_handler(NULL);
free(tempf);
--
2.11.1
More information about the wine-patches
mailing list