Commit 27759315 authored by Lauri Kenttä's avatar Lauri Kenttä Committed by Alexandre Julliard

msvcrt: Check pmode in _wsopen_dispatch.

parent 85214c56
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment