From: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> --- dlls/secur32/schannel.c | 1 + dlls/secur32/tests/schannel.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/dlls/secur32/schannel.c b/dlls/secur32/schannel.c index 6b5df3520a7..22cd9fdf347 100644 --- a/dlls/secur32/schannel.c +++ b/dlls/secur32/schannel.c @@ -1151,6 +1151,7 @@ static SECURITY_STATUS SEC_ENTRY schan_QueryContextAttributesW( if (!context_handle) return SEC_E_INVALID_HANDLE; ctx = schan_get_object(context_handle->dwLower, SCHAN_HANDLE_CTX); + if (!ctx) return SEC_E_INVALID_HANDLE; switch(attribute) { diff --git a/dlls/secur32/tests/schannel.c b/dlls/secur32/tests/schannel.c index f0b0b20b08a..5153c9b4a1e 100644 --- a/dlls/secur32/tests/schannel.c +++ b/dlls/secur32/tests/schannel.c @@ -1529,6 +1529,10 @@ static void test_communication(void) done: DeleteSecurityContext(&context); + + status = QueryContextAttributesW(&context, SECPKG_ATTR_REMOTE_CERT_CONTEXT, (void*)&cert); + ok(status == SEC_E_INVALID_HANDLE, "QueryContextAttributesW(SECPKG_ATTR_REMOTE_CERT_CONTEXT) got %08lx\n", status); + FreeCredentialsHandle(&cred_handle); CertFreeCertificateContext(cert); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/2075