=?UTF-8?Q?Lauri=20Kentt=C3=A4=20?=: msvcrt: Check pmode in _wsopen_dispatch.
Alexandre Julliard
julliard at winehq.org
Mon Feb 6 16:31:20 CST 2017
Module: wine
Branch: master
Commit: 27759315367428c6bd4bed5cf410407bd2d18fb9
URL: http://source.winehq.org/git/wine.git/?a=commit;h=27759315367428c6bd4bed5cf410407bd2d18fb9
Author: Lauri Kenttä <lauri.kentta at gmail.com>
Date: Sat Feb 4 16:38:03 2017 +0200
msvcrt: Check pmode in _wsopen_dispatch.
Signed-off-by: Lauri Kenttä <lauri.kentta at gmail.com>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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 8965156..24a6e2e 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 cc82022..d8075cc 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);
More information about the wine-cvs
mailing list