Author: tfaber
Date: Wed Feb 22 12:02:59 2012
New Revision: 55805

URL: http://svn.reactos.org/svn/reactos?rev=55805&view=rev
Log:
[RTL]
- Fix use of uninitialized variables in failure case of 
RtlSetCurrentDirectory_U. CID 15339, 15340
- Handles should be NULL, not 0

Modified:
    trunk/reactos/lib/rtl/path.c

Modified: trunk/reactos/lib/rtl/path.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/path.c?rev=55805&r1=55804&r2=55805&view=diff
==============================================================================
--- trunk/reactos/lib/rtl/path.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/path.c [iso-8859-1] Wed Feb 22 12:02:59 2012
@@ -1009,9 +1009,12 @@
     OBJECT_ATTRIBUTES ObjectAttributes;
     FILE_FS_DEVICE_INFORMATION FileFsDeviceInfo;
     ULONG SavedLength, CharLength, FullPathLength;
-    HANDLE OldHandle = 0, CurDirHandle, OldCurDirHandle = 0;
+    HANDLE OldHandle = NULL, CurDirHandle = NULL, OldCurDirHandle = NULL;
 
     DPRINT("RtlSetCurrentDirectory_U %wZ\n", Path);
+
+    /* Initialize for failure case */
+    RtlInitEmptyUnicodeString(&NtName, NULL, 0);
 
     /* Can't set current directory on DOS device */
     if (RtlIsDosDeviceName_Ustr(Path))
@@ -1075,7 +1078,7 @@
     {
         /* Get back normal handle */
         CurDirHandle = (HANDLE)((ULONG_PTR)(CurDir->Handle) & 
~RTL_CURDIR_ALL_FLAGS);
-        CurDir->Handle = 0;
+        CurDir->Handle = NULL;
 
         /* Get device information */
         Status = NtQueryVolumeInformationFile(CurDirHandle,
@@ -1157,7 +1160,7 @@
     /* Save new data */
     CurDir->Handle = CurDirHandle;
     RtlpCurDirRef->Handle = CurDirHandle;
-    CurDirHandle = 0;
+    CurDirHandle = NULL;
 
     /* Copy full path */
     RtlCopyMemory(CurDir->DosPath.Buffer, FullPath.Buffer, FullPath.Length + 
sizeof(WCHAR));


Reply via email to