[UDFS] Fix NewCFBName leakage in UDFFirstOpenFile()

CORE-11098
This commit is contained in:
Victor Martinez 2019-08-17 16:39:55 +03:00 committed by Victor Perevertkin
parent b64865fbdf
commit e5e4362b6d

View file

@ -2312,7 +2312,10 @@ UDFFirstOpenFile(
((LocalPath->Buffer[LocalPath->Length/sizeof(WCHAR)-1] != L':') /*&&
(LocalPath->Buffer[LocalPath->Length/sizeof(WCHAR)-1] != L'\\')*/) )) {
RC = MyAppendUnicodeToString(&(NewFCBName->ObjectName), L"\\");
if(!NT_SUCCESS(RC)) return STATUS_INSUFFICIENT_RESOURCES;
if(!NT_SUCCESS(RC)) {
UDFReleaseObjectName(NewFCBName);
return STATUS_INSUFFICIENT_RESOURCES;
}
}
// Make link between Fcb and FileInfo
@ -2321,9 +2324,11 @@ UDFFirstOpenFile(
(*PtrNewFcb)->ParentFcb = RelatedFileInfo->Fcb;
if(!((*PtrNewFcb)->NTRequiredFCB = NewFileInfo->Dloc->CommonFcb)) {
if(!((*PtrNewFcb)->NTRequiredFCB =
(PtrUDFNTRequiredFCB)MyAllocatePool__(NonPagedPool, UDFQuadAlign(sizeof(UDFNTRequiredFCB))) ) )
(*PtrNewFcb)->NTRequiredFCB = (PtrUDFNTRequiredFCB)MyAllocatePool__(NonPagedPool, UDFQuadAlign(sizeof(UDFNTRequiredFCB)));
if(!((*PtrNewFcb)->NTRequiredFCB)) {
UDFReleaseObjectName(NewFCBName);
return STATUS_INSUFFICIENT_RESOURCES;
}
UDFPrint(("UDFAllocateNtReqFCB: %x\n", (*PtrNewFcb)->NTRequiredFCB));
RtlZeroMemory((*PtrNewFcb)->NTRequiredFCB, UDFQuadAlign(sizeof(UDFNTRequiredFCB)));
@ -2333,6 +2338,7 @@ UDFFirstOpenFile(
if(!(NewFileInfo->Dloc->CommonFcb->NtReqFCBFlags & UDF_NTREQ_FCB_VALID)) {
(*PtrNewFcb)->NTRequiredFCB = NULL;
BrutePoint();
UDFReleaseObjectName(NewFCBName);
return STATUS_ACCESS_DENIED;
}
}