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

Fix crash in HttpClient on Unix when using client certificates #9131

Merged
merged 1 commit into from
Jun 4, 2016

Conversation

stephentoub
Copy link
Member

In HttpClient on Unix when a client certificate is used, we add the intermediate certificates for the client authentication cert's chain so that the server can chain-verify. When we add the extra chain certificate to the SSL handle, we're transferring ownership to that handle, which we subequently dispose... but we don't mark the original SafeHandle as invalid, so it eventually gets finalized and we end up double-free'ing, leading to seg faults and other badness. This commit simply cleans up the handle appropriately.

cc: @bartonjs, @billwert

In HttpClient on Unix when a client certificate is used, we add the intermediate certificates for the client authentication cert's chain so that the server can chain-verify.  When we add the extra chain certificate to the SSL handle, we're transferring ownership to that handle, which we subequently dispose... but we don't mark the original SafeHandle as invalid, so it eventually gets finalized and we end up double-free'ing, leading to seg faults and other badness.  This commit simply cleans up the handle appropriately.
@bartonjs
Copy link
Member

bartonjs commented Jun 3, 2016

LGTM. Thanks for your help here, Steve.

@stephentoub
Copy link
Member Author

Both Ubuntu legs passed; for some reason GitHub is still showing them in process, though.

@stephentoub stephentoub merged commit 30eee0b into dotnet:master Jun 4, 2016
@stephentoub stephentoub deleted the fix_clientcert_crash branch June 4, 2016 01:57
@karelz karelz added os-linux Linux OS (any supported distro) and removed X-Plat labels Mar 8, 2017
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…_crash

Fix crash in HttpClient on Unix when using client certificates

Commit migrated from dotnet/corefx@30eee0b
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Net os-linux Linux OS (any supported distro)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants