diff --git a/phlib/firmware.c b/phlib/firmware.c index 86708c37f..d063f2807 100644 --- a/phlib/firmware.c +++ b/phlib/firmware.c @@ -1030,7 +1030,6 @@ NTSTATUS PhGetSMBIOSString( if (!string->Buffer) return STATUS_INVALID_PARAMETER; - // The conversion may return null, and success here promises the caller a string. if (!(*String = PhConvertUtf8ToUtf16Ex(string->Buffer, string->Length))) return STATUS_UNSUCCESSFUL; diff --git a/phlib/mapimg.c b/phlib/mapimg.c index 55abe34b0..b0ca443f8 100644 --- a/phlib/mapimg.c +++ b/phlib/mapimg.c @@ -5586,7 +5586,6 @@ NTSTATUS PhGetMappedImageDebug( Debug->MappedImage = MappedImage; Debug->DataDirectory = dataDirectory; Debug->DebugDirectory = debugDirectory; - // The walk stops at the first entry that is not there, so what was filled is what may be read. Debug->NumberOfEntries = (ULONG)PhFinalArrayCount(&debugEntryArray); Debug->DebugEntries = PhFinalArrayItems(&debugEntryArray); diff --git a/phlib/native.c b/phlib/native.c index 726e9db69..b7baf8ec6 100644 --- a/phlib/native.c +++ b/phlib/native.c @@ -865,8 +865,6 @@ NTSTATUS PhGetProcessUnloadedDlls( goto CleanupExit; } - // The stride is the target's own ntdll data, and every caller reads a whole element at it, so - // anything shorter than one element cannot be walked at all. if (capturedElementSize < sizeof(RTL_UNLOAD_EVENT_TRACE)) { status = STATUS_INVALID_BUFFER_SIZE; diff --git a/plugins/AgentTools/consent.c b/plugins/AgentTools/consent.c index 114edd8c3..3669aecc7 100644 --- a/plugins/AgentTools/consent.c +++ b/plugins/AgentTools/consent.c @@ -182,10 +182,11 @@ VOID AtpAppendStdioClients( { PPH_STRING name; - // Built and neutralised on its own: the process item's name is shared, so it must not - // be edited where it lies. - name = PhFormatString(L"%s (%lu)", - PhGetStringOrDefault(processItem->ProcessName, L"unknown"), HandleToUlong(processId)); + name = PhFormatString( + L"%s (%lu)", + PhGetStringOrDefault(processItem->ProcessName, L"unknown"), + HandleToUlong(processId) + ); AtSanitizeDisplayString(name); PhAppendStringBuilder(Builder, &name->sr); diff --git a/plugins/AgentTools/schema.c b/plugins/AgentTools/schema.c index 12e4e317a..684e99692 100644 --- a/plugins/AgentTools/schema.c +++ b/plugins/AgentTools/schema.c @@ -1103,7 +1103,7 @@ CONST AT_TOOL AtTools[] = "\"outputSchema\":{\"type\":\"object\",\"properties\":{" AT_PROCESS_IDENTITY_SCHEMA "," "\"mitigations\":{\"type\":\"object\",\"description\":\"One member per policy; each is an object of flags, or null when that policy could not be read\",\"properties\":{" - + "\"aslr\":{\"type\":[\"object\",\"null\"],\"properties\":{\"bottom_up_randomization\":{\"type\":\"boolean\"},\"disallow_stripped_images\":{\"type\":\"boolean\"},\"force_relocate_images\":{\"type\":\"boolean\"},\"high_entropy\":{\"type\":\"boolean\"}}}," "\"dynamic_code\":{\"type\":[\"object\",\"null\"],\"properties\":{\"allow_remote_downgrade\":{\"type\":\"boolean\"},\"allow_thread_opt_out\":{\"type\":\"boolean\"},\"audit_prohibit_dynamic_code\":{\"type\":\"boolean\"},\"prohibit_dynamic_code\":{\"type\":\"boolean\"}},\"description\":\"prohibit_dynamic_code stops the process generating or modifying executable code\"}," "\"strict_handle_check\":{\"type\":[\"object\",\"null\"],\"properties\":{\"handle_exceptions_permanently_enabled\":{\"type\":\"boolean\"},\"raise_exception_on_invalid_handle_reference\":{\"type\":\"boolean\"}}}," diff --git a/plugins/AgentTools/server.c b/plugins/AgentTools/server.c index b12d3c303..b76fc8fa6 100644 --- a/plugins/AgentTools/server.c +++ b/plugins/AgentTools/server.c @@ -568,9 +568,6 @@ VOID AtpResolveLauncher( times.CreateTime.QuadPart == Hello->LauncherStartTime.QuadPart) { PhGetProcessImageFileNameWin32(processHandle, &Connection->LauncherImageName); - - // A file name may legally carry the overrides that make it display as another name, and - // the launcher is whatever the caller chose to start the broker from. AtSanitizeDisplayString(Connection->LauncherImageName); } diff --git a/plugins/AgentTools/target.c b/plugins/AgentTools/target.c index 077e975fe..5b3e5a747 100644 --- a/plugins/AgentTools/target.c +++ b/plugins/AgentTools/target.c @@ -729,7 +729,6 @@ NTSTATUS AtpResolveTargetParameter( return STATUS_SUCCESS; } - // The value is the caller's, and it is shown to the user and written to the audit log. AtSanitizeDisplayString(text); *Parameter = text; @@ -896,7 +895,6 @@ PPH_STRING AtFormatTargetHeadline( PhClearReference(&process); - // Process, service and device names are chosen by whoever created them, not by us. AtSanitizeDisplayString(result); return result; @@ -984,7 +982,6 @@ PPH_STRING AtFormatTargetDescription( break; } - // Image paths, signer names, object names and user names all come from elsewhere. result = PhFinalStringBuilderString(&builder); AtSanitizeDisplayString(result); @@ -1023,8 +1020,6 @@ PPH_STRING AtFormatTargetAudit( } PhDereferenceObject(headline); - - // The headline arrives clean; the image path appended to it does not. AtSanitizeDisplayString(result); return result; diff --git a/plugins/AgentTools/tooldisk.c b/plugins/AgentTools/tooldisk.c index 02325860a..504b0a5a3 100644 --- a/plugins/AgentTools/tooldisk.c +++ b/plugins/AgentTools/tooldisk.c @@ -217,8 +217,6 @@ PSTORAGE_DEVICE_DESCRIPTOR AtpQueryDiskDescriptor( return NULL; } - // Every string offset is measured against the size the device wrote into the buffer, so that - // size has to lie inside what the call actually returned. if (descriptor->Size > returnedLength) { PhFree(descriptor); diff --git a/plugins/AgentTools/tools.c b/plugins/AgentTools/tools.c index c44439e65..00606b237 100644 --- a/plugins/AgentTools/tools.c +++ b/plugins/AgentTools/tools.c @@ -893,13 +893,6 @@ PPH_STRING AtGetArgumentString( return PhGetJsonValueAsString(Arguments, Key); } -/** - * Requires a file name from the caller to name a local drive. - * - * A UNC or device path would have System Informer open it, elevated, from wherever the caller - * chose, and parse whatever came back. A path that was not supplied is left alone: whether one was - * required is the tool's own question, asked before this. - */ BOOLEAN AtCheckDriveAbsolutePath( _In_opt_ PPH_STRING Path, _Inout_ PAT_TOOL_RESULT Result @@ -918,15 +911,6 @@ BOOLEAN AtCheckDriveAbsolutePath( return FALSE; } -/** - * Answers whether a character may not appear in text the user is shown. - * - * The C0 range and delete are the obvious ones. The rest are the characters that change how the - * text around them reads rather than adding anything of their own: the bidirectional overrides and - * embeddings, which can make a name display in reverse; the zero-width joiners and the zero-width - * no-break space, which hide a join; and the separators Windows controls treat as a line break, - * which would let text from elsewhere push its own line into a consent prompt. - */ BOOLEAN AtIsUnsafeDisplayChar( _In_ WCHAR Character ) @@ -965,8 +949,6 @@ BOOLEAN AtIsUnsafeDisplayChar( return FALSE; } -// Neutralises in place, so the string must be unshared. Nothing is truncated and nothing is -// re-worded: the user is shown the whole value, only unable to be lied to by its characters. VOID AtSanitizeDisplayString( _In_opt_ PPH_STRING String )