Module: wine Branch: master Commit: cb489f7a2583442d47ce3a9b8c0298c120882bca URL: http://source.winehq.org/git/wine.git/?a=commit;h=cb489f7a2583442d47ce3a9b8c...
Author: Jeff Latimer lats@yless4u.com.au Date: Tue Feb 27 23:42:02 2007 +1100
ntdll: Check for passing a NULL handle to NtCreateMailslotFile and add a test.
---
dlls/ntdll/file.c | 2 ++ dlls/ntdll/tests/file.c | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index cf9d64d..ffda379 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -2210,6 +2210,8 @@ NTSTATUS WINAPI NtCreateMailslotFile(PHANDLE pHandle, ULONG DesiredAccess, pHandle, DesiredAccess, attr, IoStatusBlock, CreateOptions, MailslotQuota, MaxMessageSize, TimeOut);
+ if (!pHandle) return STATUS_ACCESS_VIOLATION; + if (attr->ObjectName->Length < sizeof(leadin) || strncmpiW( attr->ObjectName->Buffer, leadin, sizeof(leadin)/sizeof(leadin[0]) )) diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index 15ed4dc..9baadfe 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -55,11 +55,19 @@ static void nt_mailslot_test(void) WCHAR buffer1[] = { '\','?','?','\','M','A','I','L','S','L','O','T','\', 'R',':','\','F','R','E','D','\0' };
+ TimeOut.QuadPart = -1;
pRtlInitUnicodeString(&str, buffer1); InitializeObjectAttributes(&attr, &str, OBJ_CASE_INSENSITIVE, 0, NULL); DesiredAccess = CreateOptions = MailslotQuota = MaxMessageSize = 0; - TimeOut.QuadPart = -1; + + /* + * Check for NULL pointer handling + */ + rc = pNtCreateMailslotFile(NULL, DesiredAccess, + &attr, &IoStatusBlock, CreateOptions, MailslotQuota, MaxMessageSize, + &TimeOut); + ok( rc == STATUS_ACCESS_VIOLATION, "rc = %x not c0000005 STATUS_ACCESS_VIOLATION\n", rc);
/* * Test a valid call