[NTFS]
authorPierre Schweitzer <pierre@reactos.org>
Sat, 14 Feb 2015 15:41:44 +0000 (15:41 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Sat, 14 Feb 2015 15:41:44 +0000 (15:41 +0000)
NtfsMoonWalkID():
- Do not allow opening a file by ID if it's not in use any longer
- Do not attempt to create the full path, if an error occured during walk

svn path=/trunk/; revision=66265

reactos/drivers/filesystems/ntfs/create.c

index 70b3ba2..4b7e74f 100644 (file)
@@ -116,6 +116,11 @@ NtfsMoonWalkID(PDEVICE_EXTENSION DeviceExt,
             break;
 
         ASSERT(MftRecord->Ntfs.Type == NRH_FILE_TYPE);
             break;
 
         ASSERT(MftRecord->Ntfs.Type == NRH_FILE_TYPE);
+        if (!(MftRecord->Flags & FRH_IN_USE))
+        {
+            Status = STATUS_OBJECT_PATH_NOT_FOUND;
+            break;
+        }
 
         FileName = GetBestFileNameFromRecord(MftRecord);
         WritePosition -= FileName->NameLength;
 
         FileName = GetBestFileNameFromRecord(MftRecord);
         WritePosition -= FileName->NameLength;
@@ -132,6 +137,9 @@ NtfsMoonWalkID(PDEVICE_EXTENSION DeviceExt,
 
     ExFreePoolWithTag(MftRecord, TAG_NTFS);
 
 
     ExFreePoolWithTag(MftRecord, TAG_NTFS);
 
+    if (!NT_SUCCESS(Status))
+        return Status;
+
     OutPath->Length = (MAX_PATH - WritePosition - 1) * sizeof(WCHAR);
     OutPath->MaximumLength = (MAX_PATH - WritePosition) * sizeof(WCHAR);
     OutPath->Buffer = ExAllocatePoolWithTag(NonPagedPool, OutPath->MaximumLength, TAG_NTFS);
     OutPath->Length = (MAX_PATH - WritePosition - 1) * sizeof(WCHAR);
     OutPath->MaximumLength = (MAX_PATH - WritePosition) * sizeof(WCHAR);
     OutPath->Buffer = ExAllocatePoolWithTag(NonPagedPool, OutPath->MaximumLength, TAG_NTFS);