Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix handle security if object name cannot be retrieved #2318

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion SystemInformer/prpghndl.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ INT_PTR CALLBACK PhpProcessHandlesDlgProc(

PhEditSecurity(
PhCsForceNoParent ? NULL : hwndDlg,
PhGetString(handleItem->ObjectName),
PhGetStringOrEmpty(handleItem->ObjectName),
DartVanya marked this conversation as resolved.
Show resolved Hide resolved
PhGetString(handleItem->TypeName),
PhpProcessHandleOpenCallback,
PhpProcessHandleCloseCallback,
Expand Down
12 changes: 5 additions & 7 deletions plugins/ExtendedTools/objmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -2264,7 +2264,7 @@ VOID NTAPI EtpObjectManagerObjectProperties(
}

objectContext.CurrentPath = PhReferenceObject(context->CurrentPath);
objectContext.Object = PhReferenceObject(Entry);
objectContext.Object = Entry;
DartVanya marked this conversation as resolved.
Show resolved Hide resolved
objectContext.FullName = NULL;

if (Entry->EtObjectType == EtObjectDirectory)
Expand Down Expand Up @@ -2369,7 +2369,6 @@ VOID NTAPI EtpObjectManagerObjectProperties(
// Object Manager plugin window
PhShowHandlePropertiesEx(context->WindowHandle, processId, handleItem, PluginInstance, PhGetString(Entry->TypeName));

PhDereferenceObject(Entry);
PhDereferenceObject(objectContext.CurrentPath);
}

Expand Down Expand Up @@ -2679,7 +2678,7 @@ VOID NTAPI EtpObjectManagerSearchControlCallback(
else
oldSelect = PhReferenceObject(context->CurrentPath);

PhSetDialogItemText(context->WindowHandle, IDC_OBJMGR_PATH, PhGetString(oldSelect));
PhSetWindowText(context->PathControlHandle, PhGetString(oldSelect));
PhDereferenceObject(oldSelect);

WCHAR string[PH_INT32_STR_LEN_1];
Expand Down Expand Up @@ -2756,7 +2755,7 @@ VOID EtpObjectManagerCopyObjectAddress(
}

objectContext.CurrentPath = PhReferenceObject(context->CurrentPath);
objectContext.Object = PhReferenceObject(Entry);
objectContext.Object = Entry;
DartVanya marked this conversation as resolved.
Show resolved Hide resolved
objectContext.FullName = NULL;

if (NT_SUCCESS(status = EtObjectManagerOpenHandle(&objectHandle, &objectContext, READ_CONTROL, OBJECT_OPENSOURCE_ALL)) ||
Expand Down Expand Up @@ -2796,7 +2795,6 @@ VOID EtpObjectManagerCopyObjectAddress(
cleanup_exit:
PhSetClipboardString(context->WindowHandle, &pointer);

PhDereferenceObject(Entry);
PhDereferenceObject(objectContext.CurrentPath);
}

Expand All @@ -2815,7 +2813,7 @@ VOID EtpObjectEntryDeleteProcedure(
PhClearReference(&entry->BaseDirectory);
}

VOID EtpLoadComboBoxHistoryToSettings(
VOID EtpLoadComboBoxHistoryFromSettings(
_In_ PET_OBJECT_CONTEXT Context
)
{
Expand Down Expand Up @@ -3010,7 +3008,7 @@ INT_PTR CALLBACK WinObjDlgProc(
if (PhIsNullOrEmptyString(Target)) // HACK
Target = PH_AUTO(PhCreateString2(&EtObjectManagerRootDirectoryObject));

EtpLoadComboBoxHistoryToSettings(context);
EtpLoadComboBoxHistoryFromSettings(context);

context->DisableSelChanged = TRUE;
EtpObjectManagerOpenTarget(context, Target);
Expand Down
Loading