Paul Vriens : ntdll: Extra check for ObjectAttributes (Coverity).

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jan 22 07:05:26 CST 2007


Module: wine
Branch: master
Commit: cbf9fde47ac9ac783aa17d477f87e89a058b9ac1
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=cbf9fde47ac9ac783aa17d477f87e89a058b9ac1

Author: Paul Vriens <paul.vriens.wine at gmail.com>
Date:   Sun Jan 21 21:14:35 2007 +0100

ntdll: Extra check for ObjectAttributes (Coverity).

---

 dlls/ntdll/om.c       |    2 +-
 dlls/ntdll/tests/om.c |    7 +++++++
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/dlls/ntdll/om.c b/dlls/ntdll/om.c
index cac8713..6057caa 100644
--- a/dlls/ntdll/om.c
+++ b/dlls/ntdll/om.c
@@ -562,7 +562,7 @@ NTSTATUS WINAPI NtCreateSymbolicLinkObje
         req->access = DesiredAccess;
         req->attributes = ObjectAttributes ? ObjectAttributes->Attributes : 0;
         req->rootdir = ObjectAttributes ? ObjectAttributes->RootDirectory : 0;
-        if (ObjectAttributes->ObjectName)
+        if (ObjectAttributes && ObjectAttributes->ObjectName)
         {
             req->name_len = ObjectAttributes->ObjectName->Length;
             wine_server_add_data(req, ObjectAttributes->ObjectName->Buffer,
diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c
index 557ee41..e7978a2 100644
--- a/dlls/ntdll/tests/om.c
+++ b/dlls/ntdll/tests/om.c
@@ -483,6 +483,13 @@ void test_symboliclink(void)
     ok(status == STATUS_INVALID_PARAMETER,
         "NtOpenSymbolicLinkObject should have failed with STATUS_INVALID_PARAMETER got(%08x)\n", status);
 
+    /* No attributes */
+    pRtlCreateUnicodeStringFromAsciiz(&target, "\\DosDevices");
+    status = pNtCreateSymbolicLinkObject(&h, SYMBOLIC_LINK_QUERY, NULL, &target);
+    ok(status == STATUS_SUCCESS, "NtCreateSymbolicLinkObject failed(%08x)\n", status);
+    pRtlFreeUnicodeString(&target);
+    pNtClose(h);
+
     InitializeObjectAttributes(&attr, NULL, 0, 0, NULL);
     SYMLNK_TEST_CREATE_FAILURE(&link, STATUS_INVALID_PARAMETER)
     SYMLNK_TEST_OPEN_FAILURE(&h, STATUS_OBJECT_PATH_SYNTAX_BAD)




More information about the wine-cvs mailing list