Commit ebf4953e authored by Santino Mazza's avatar Santino Mazza Committed by Alexandre Julliard

ncrypt: Check null handle when setting or getting properties.

parent e08c2f35
......@@ -164,7 +164,9 @@ SECURITY_STATUS WINAPI NCryptGetProperty(NCRYPT_HANDLE handle, const WCHAR *name
TRACE("(%#Ix, %s, %p, %lu, %p, %#lx)\n", handle, wine_dbgstr_w(name), output, outsize, result, flags);
if (flags) FIXME("flags %#lx not supported\n", flags);
if (!object) return NTE_INVALID_HANDLE;
if (!(property = get_object_property(object, name))) return NTE_INVALID_PARAMETER;
*result = property->value_size;
if (!output) return ERROR_SUCCESS;
if (outsize < property->value_size) return NTE_BUFFER_TOO_SMALL;
......@@ -376,6 +378,7 @@ SECURITY_STATUS WINAPI NCryptSetProperty(NCRYPT_HANDLE handle, const WCHAR *name
TRACE("(%#Ix, %s, %p, %lu, %#lx)\n", handle, wine_dbgstr_w(name), input, insize, flags);
if (flags) FIXME("flags %#lx not supported\n", flags);
if (!object) return NTE_INVALID_HANDLE;
return set_object_property(object, name, input, insize);
}
......
......@@ -199,6 +199,9 @@ static void test_get_property(void)
ok(ret == ERROR_SUCCESS, "got %#lx\n", ret);
ok(keylength == 1024, "got %lu\n", keylength);
ret = NCryptGetProperty(0, NCRYPT_LENGTH_PROPERTY, (BYTE *)&keylength, size, &size, 0);
ok(ret == NTE_INVALID_HANDLE, "got %#lx\n", ret);
NCryptFreeObject(prov);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment