diff --git a/phlib/mapimg.c b/phlib/mapimg.c index 8b460574e58a..08d0d8062bdf 100644 --- a/phlib/mapimg.c +++ b/phlib/mapimg.c @@ -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; } @@ -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; } diff --git a/phnt/include/ntbcd.h b/phnt/include/ntbcd.h index 5ff4e089005b..fa9843fdff69 100644 --- a/phnt/include/ntbcd.h +++ b/phnt/include/ntbcd.h @@ -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 ); diff --git a/phnt/include/ntmmapi.h b/phnt/include/ntmmapi.h index 8099acfb17b7..9bfd5152e648 100644 --- a/phnt/include/ntmmapi.h +++ b/phnt/include/ntmmapi.h @@ -181,7 +181,7 @@ typedef struct _MEMORY_WORKING_SET_BLOCK typedef struct _MEMORY_WORKING_SET_INFORMATION { ULONG_PTR NumberOfEntries; - _Field_size_(NumberOfEntries) MEMORY_WORKING_SET_BLOCK WorkingSetInfo[1]; + _Field_size_(NumberOfEntries) MEMORY_WORKING_SET_BLOCK WorkingSetInfo[ANYSIZE_ARRAY]; } MEMORY_WORKING_SET_INFORMATION, *PMEMORY_WORKING_SET_INFORMATION; // private @@ -271,7 +271,7 @@ typedef union _MEMORY_WORKING_SET_EX_BLOCK #endif } Invalid; }; -} MEMORY_WORKING_SET_EX_BLOCK, * PMEMORY_WORKING_SET_EX_BLOCK; +} MEMORY_WORKING_SET_EX_BLOCK, *PMEMORY_WORKING_SET_EX_BLOCK; /** * The MEMORY_WORKING_SET_EX_INFORMATION structure contains extended working set information for a process. diff --git a/phnt/include/ntpebteb.h b/phnt/include/ntpebteb.h index 6006a020e680..0ccaa1a5d265 100644 --- a/phnt/include/ntpebteb.h +++ b/phnt/include/ntpebteb.h @@ -131,7 +131,7 @@ typedef struct _WER_MEMORY typedef struct _WER_GATHER { PVOID Next; - USHORT Flags; + USHORT Flags; union { WER_FILE File; diff --git a/phnt/include/ntrtl.h b/phnt/include/ntrtl.h index bf2cb20a21e7..61ce5f17228b 100644 --- a/phnt/include/ntrtl.h +++ b/phnt/include/ntrtl.h @@ -10208,7 +10208,7 @@ NTSTATUS NTAPI RtlProcessFlsData( _In_ HANDLE ProcessHandle, - _Out_ PPVOID FlsData + _Out_ PVOID* FlsData ); #endif diff --git a/phnt/include/winsta.h b/phnt/include/winsta.h index f1c439a11277..f5a9b0ec6199 100644 --- a/phnt/include/winsta.h +++ b/phnt/include/winsta.h @@ -1251,7 +1251,7 @@ WinStationQuerySessionVirtualIP( _In_ ADDRESS_FAMILY Family, _Out_ TS_SESSION_VIRTUAL_ADDRESS* SessionVirtualIP ); - + // rev NTSYSAPI BOOLEAN @@ -1262,7 +1262,7 @@ WinStationGetDeviceId( _Out_ PCHAR* Buffer, // CHAR DeviceId[MAX_PATH + 1]; _In_ SIZE_T BufferLength ); - + // rev NTSYSAPI BOOLEAN diff --git a/plugins/ExtendedTools/objprp.c b/plugins/ExtendedTools/objprp.c index 7ae2109b2576..2ca46ff490e1 100644 --- a/plugins/ExtendedTools/objprp.c +++ b/plugins/ExtendedTools/objprp.c @@ -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);