Skip to content

Commit

Permalink
Merge branch 'master' into phnt_trivial_improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
jxy-s authored Jan 3, 2025
2 parents 65d9082 + 9cb5ebe commit b7d2f72
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions phlib/mapimg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1360,18 +1360,19 @@ NTSTATUS PhGetRemoteMappedImageGuardFlagsEx(
if (RemoteMappedImage->Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC)
{
PIMAGE_LOAD_CONFIG_DIRECTORY32 config32 = NULL;
ULONG config32Length = 0;

status = PhGetRemoteMappedImageDirectoryEntry(
RemoteMappedImage,
ReadVirtualMemoryCallback,
IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG,
&config32,
NULL
&config32Length
);

if (NT_SUCCESS(status))
{
if (RTL_CONTAINS_FIELD(config32, config32->Size, GuardFlags))
if (RTL_CONTAINS_FIELD(config32, min(config32->Size, config32Length), GuardFlags))
{
guardFlags = config32->GuardFlags;
}
Expand All @@ -1386,18 +1387,19 @@ NTSTATUS PhGetRemoteMappedImageGuardFlagsEx(
else
{
PIMAGE_LOAD_CONFIG_DIRECTORY64 config64 = NULL;
ULONG config64Length = 0;

status = PhGetRemoteMappedImageDirectoryEntry(
RemoteMappedImage,
ReadVirtualMemoryCallback,
IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG,
&config64,
NULL
&config64Length
);

if (NT_SUCCESS(status))
{
if (RTL_CONTAINS_FIELD(config64, config64->Size, GuardFlags))
if (RTL_CONTAINS_FIELD(config64, min(config64->Size, config64Length), GuardFlags))
{
guardFlags = config64->GuardFlags;
}
Expand Down
2 changes: 1 addition & 1 deletion phnt/include/ntbcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ NTSTATUS
NTAPI
BcdCopyObjects(
_In_ HANDLE BcdStoreHandle,
_In_ BCD_OBJECT_DESCRIPTION Characteristics,
_In_ PBCD_OBJECT_DESCRIPTION Characteristics,
_In_ BCD_COPY_FLAGS BcdCopyFlags,
_In_ HANDLE TargetStoreHandle
);
Expand Down
2 changes: 1 addition & 1 deletion plugins/ExtendedTools/objprp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1438,7 +1438,7 @@ VOID EtpEnumObjectHandles(
}
}

if (handleInfo->Object == Context->HandleItem->Object || objectNameMatched)
if ((handleInfo->Object && handleInfo->Object == Context->HandleItem->Object) || objectNameMatched)
{
if (useWorkQueue) PhAcquireQueuedLockExclusive(&searchResultsLock);
PhAddItemList(searchResults, handleInfo);
Expand Down

0 comments on commit b7d2f72

Please sign in to comment.