From 6d5fb456815fd12ccb924a18e47c81d012270615 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Wed, 22 Feb 2012 12:02:59 +0000 Subject: [PATCH] [RTL] - Fix use of uninitialized variables in failure case of RtlSetCurrentDirectory_U. CID 15339, 15340 - Handles should be NULL, not 0 svn path=/trunk/; revision=55805 --- reactos/lib/rtl/path.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/reactos/lib/rtl/path.c b/reactos/lib/rtl/path.c index 78b79a10aea..b9643b37ab6 100644 --- a/reactos/lib/rtl/path.c +++ b/reactos/lib/rtl/path.c @@ -1009,10 +1009,13 @@ RtlSetCurrentDirectory_U(IN PUNICODE_STRING Path) 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 @@ RtlSetCurrentDirectory_U(IN PUNICODE_STRING Path) { /* 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 @@ RtlSetCurrentDirectory_U(IN PUNICODE_STRING Path) /* 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));