secur32: QueryContextAttributesW check for valid object before use.

This commit is contained in:
Alistair Leslie-Hughes 2023-01-31 12:37:09 +11:00 committed by Alexandre Julliard
parent 1b1f8d914e
commit cbddd3930b
2 changed files with 6 additions and 2 deletions

View file

@ -1149,8 +1149,8 @@ static SECURITY_STATUS SEC_ENTRY schan_QueryContextAttributesW(
TRACE("context_handle %p, attribute %#lx, buffer %p\n",
context_handle, attribute, buffer);
if (!context_handle) return SEC_E_INVALID_HANDLE;
ctx = schan_get_object(context_handle->dwLower, SCHAN_HANDLE_CTX);
if (!context_handle || !(ctx = schan_get_object(context_handle->dwLower, SCHAN_HANDLE_CTX)))
return SEC_E_INVALID_HANDLE;
switch(attribute)
{

View file

@ -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);