[NTOBJSHEX] Return early from GetInfoFromPidl when pcidl is null in LPCITEMIDLIST (#4946)

This fixes a crash when attempting to drag-n-drop items from NTObject Namespace and System Registry.
CORE-18480, CORE-18481
This commit is contained in:
Muthu R Kumar 2022-12-31 07:53:02 -08:00 committed by GitHub
parent d395c30967
commit 7fff96e7fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View file

@ -516,8 +516,13 @@ BOOL CNtObjectFolder::IsFolder(const NtPidlEntry * info)
HRESULT CNtObjectFolder::GetInfoFromPidl(LPCITEMIDLIST pcidl, const NtPidlEntry ** pentry)
{
NtPidlEntry * entry = (NtPidlEntry*) &(pcidl->mkid);
if (!pcidl)
{
DbgPrint("PCIDL is NULL\n");
return E_INVALIDARG;
}
NtPidlEntry * entry = (NtPidlEntry*) &(pcidl->mkid);
if (entry->cb < sizeof(NtPidlEntry))
{
DbgPrint("PCIDL too small %l (required %l)\n", entry->cb, sizeof(NtPidlEntry));

View file

@ -469,8 +469,13 @@ BOOL CRegistryFolder::IsFolder(const RegPidlEntry * info)
HRESULT CRegistryFolder::GetInfoFromPidl(LPCITEMIDLIST pcidl, const RegPidlEntry ** pentry)
{
RegPidlEntry * entry = (RegPidlEntry*) &(pcidl->mkid);
if (!pcidl)
{
DbgPrint("PCIDL is NULL\n");
return E_INVALIDARG;
}
RegPidlEntry * entry = (RegPidlEntry*) &(pcidl->mkid);
if (entry->cb < sizeof(RegPidlEntry))
{
DbgPrint("PCIDL too small %l (required %l)\n", entry->cb, sizeof(RegPidlEntry));