John Lambert
John Lambert
I am not an expert on this but from my reading, if you need to free unmanaged resources, you can implement IDisposable. `LocalGroupTasks.cs` has a helper class that tries to...
I think there is a problem with this coding pattern : ```c# var netWkstaTask = Task.Run(() => NetWkstaGetInfo(hostname, 100, out wkstaData)); if (await Task.WhenAny(Task.Delay(5000), netWkstaTask) != netWkstaTask) return (false, new...
Add error handling to clean up handle leaks and free buffers in failure cases.
Successful calls to `CreateProcess` and `CreateProcessAsUser` return a thread and process handle to the caller via the `ProcInfo` parameter. These need to be explicitly closed otherwise they will be leaked....
These are mostly hygiene issues than actual bugs. Resource allocations will be freed at process exit anyway. But the code takes care to release resources and so just noting them....
The security descriptor returned from GetSecurityInfo needs to be freed by the caller: https://docs.microsoft.com/en-us/windows/win32/api/aclapi/nf-aclapi-getsecurityinfo > A pointer to a variable that receives a pointer to the security descriptor of the...
Some code correctness issues in PPLDump These are hygiene issues. Some of these are low priority and edge cases. I initially spotted these in the port of the code here:...
## Issue 1: serverPipe not closed in error paths warning: if you add a close at `cleanup`, it may be already closed in the function body and unless you set...
`ProcessClientThread` creates a named pipe handle `hPipe` but never closes it, resulting in a handle leak. ```diff if (success) { responseMsg = $"[*] Impersonating token {capturedSession.Value.TokenHandle} for LUID {capturedSession.Value.Luid} to...
Missing call to `FreeHGlobal` to free memory ```diff $Data.cbStruct = $WINTRUST_DATA::GetSize() ! $Data.pData = [System.Runtime.InteropServices.Marshal]::AllocHGlobal($Size) $Data.dwUIChoice = $WTD_UI::None [System.Runtime.InteropServices.Marshal]::StructureToPtr($Info, $Data.pData, $false) $SUCCESS = $wintrust::WinVerifyTrust($WindowHandle, [ref]$ActionID, [ref]$Data) if($SUCCESS -eq 0) {...