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

NamedPipeClientStream Connect with SafePipeHandle #110175

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

koenigst
Copy link
Contributor

This is a copy of #110075 without the change to the public API.

  • Checked that isConnected in the NamedPipeClientStream constructor is always true.
  • Corrected the nullability in the interop declarations.

Fixes #32760

* Check that isConnected in the NamedPipeClientStream constructor is always true.
* Added an argument test.

Fixes dotnet#32760
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Nov 26, 2024
@@ -110,7 +110,7 @@ private bool TryConnect(int timeout)
_pipeFlags |= (((int)_impersonationLevel - 1) << 16);
}

SafePipeHandle handle = CreateNamedPipeClient(_normalizedPipePath, ref secAttrs, _pipeFlags, _accessRights);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the logic is not around, it's better using assert instead of the suppression operator. One assert can cover all subsequent usages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.IO community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NamedPipeClientStream Connect can use uninitialized _normalizedPipePath
2 participants