mirror of
https://github.com/reactos/reactos.git
synced 2025-01-05 22:12:46 +00:00
[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
This commit is contained in:
parent
2541f45e51
commit
6d5fb45681
1 changed files with 6 additions and 3 deletions
|
@ -1009,10 +1009,13 @@ RtlSetCurrentDirectory_U(IN PUNICODE_STRING Path)
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
FILE_FS_DEVICE_INFORMATION FileFsDeviceInfo;
|
FILE_FS_DEVICE_INFORMATION FileFsDeviceInfo;
|
||||||
ULONG SavedLength, CharLength, FullPathLength;
|
ULONG SavedLength, CharLength, FullPathLength;
|
||||||
HANDLE OldHandle = 0, CurDirHandle, OldCurDirHandle = 0;
|
HANDLE OldHandle = NULL, CurDirHandle = NULL, OldCurDirHandle = NULL;
|
||||||
|
|
||||||
DPRINT("RtlSetCurrentDirectory_U %wZ\n", Path);
|
DPRINT("RtlSetCurrentDirectory_U %wZ\n", Path);
|
||||||
|
|
||||||
|
/* Initialize for failure case */
|
||||||
|
RtlInitEmptyUnicodeString(&NtName, NULL, 0);
|
||||||
|
|
||||||
/* Can't set current directory on DOS device */
|
/* Can't set current directory on DOS device */
|
||||||
if (RtlIsDosDeviceName_Ustr(Path))
|
if (RtlIsDosDeviceName_Ustr(Path))
|
||||||
{
|
{
|
||||||
|
@ -1075,7 +1078,7 @@ RtlSetCurrentDirectory_U(IN PUNICODE_STRING Path)
|
||||||
{
|
{
|
||||||
/* Get back normal handle */
|
/* Get back normal handle */
|
||||||
CurDirHandle = (HANDLE)((ULONG_PTR)(CurDir->Handle) & ~RTL_CURDIR_ALL_FLAGS);
|
CurDirHandle = (HANDLE)((ULONG_PTR)(CurDir->Handle) & ~RTL_CURDIR_ALL_FLAGS);
|
||||||
CurDir->Handle = 0;
|
CurDir->Handle = NULL;
|
||||||
|
|
||||||
/* Get device information */
|
/* Get device information */
|
||||||
Status = NtQueryVolumeInformationFile(CurDirHandle,
|
Status = NtQueryVolumeInformationFile(CurDirHandle,
|
||||||
|
@ -1157,7 +1160,7 @@ RtlSetCurrentDirectory_U(IN PUNICODE_STRING Path)
|
||||||
/* Save new data */
|
/* Save new data */
|
||||||
CurDir->Handle = CurDirHandle;
|
CurDir->Handle = CurDirHandle;
|
||||||
RtlpCurDirRef->Handle = CurDirHandle;
|
RtlpCurDirRef->Handle = CurDirHandle;
|
||||||
CurDirHandle = 0;
|
CurDirHandle = NULL;
|
||||||
|
|
||||||
/* Copy full path */
|
/* Copy full path */
|
||||||
RtlCopyMemory(CurDir->DosPath.Buffer, FullPath.Buffer, FullPath.Length + sizeof(WCHAR));
|
RtlCopyMemory(CurDir->DosPath.Buffer, FullPath.Buffer, FullPath.Length + sizeof(WCHAR));
|
||||||
|
|
Loading…
Reference in a new issue