Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit fd34eae

Browse files
committed
Add missing if statement
1 parent 5560aea commit fd34eae

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeClientStream.Windows.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ private void ValidateRemotePipeIsCurrentUser()
138138
{
139139
SecurityIdentifier currentUserSid = GetCurrentUser();
140140
PipeSecurity accessControl = this.GetAccessControl();
141-
142141
IdentityReference remoteOwnerSid = accessControl.GetOwner(typeof(SecurityIdentifier));
143142
if (remoteOwnerSid != currentUserSid)
144143
{

src/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Windows.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,11 +425,14 @@ internal static unsafe Interop.Kernel32.SECURITY_ATTRIBUTES GetSecAttrs(HandleIn
425425
secAttrs.bInheritHandle = Interop.BOOL.TRUE;
426426
}
427427

428-
byte[] securityDescriptor = pipeSecurity.GetSecurityDescriptorBinaryForm();
429-
pinningHandle = GCHandle.Alloc(securityDescriptor, GCHandleType.Pinned);
430-
fixed (byte* pSecurityDescriptor = securityDescriptor)
428+
if (pipeSecurity != null)
431429
{
432-
secAttrs.lpSecurityDescriptor = (IntPtr)pSecurityDescriptor;
430+
byte[] securityDescriptor = pipeSecurity.GetSecurityDescriptorBinaryForm();
431+
pinningHandle = GCHandle.Alloc(securityDescriptor, GCHandleType.Pinned);
432+
fixed (byte* pSecurityDescriptor = securityDescriptor)
433+
{
434+
secAttrs.lpSecurityDescriptor = (IntPtr)pSecurityDescriptor;
435+
}
433436
}
434437
}
435438

0 commit comments

Comments
 (0)