Commit 1db5170f authored by Sebastian Lackner's avatar Sebastian Lackner Committed by Alexandre Julliard

bcrypt: Correctly check the size in BCryptGetProperty.

parent 02a50716
......@@ -532,7 +532,7 @@ static NTSTATUS get_alg_property( enum alg_id id, const WCHAR *prop, UCHAR *buf,
}
if (!strcmpW( prop, BCRYPT_CHAINING_MODE ))
{
if (size >= sizeof(BCRYPT_CHAIN_MODE_CBC))
if (size >= sizeof(BCRYPT_CHAIN_MODE_CBC) * sizeof(WCHAR))
{
memcpy(buf, BCRYPT_CHAIN_MODE_CBC, sizeof(BCRYPT_CHAIN_MODE_CBC));
*ret_size = sizeof(BCRYPT_CHAIN_MODE_CBC) * sizeof(WCHAR);
......
......@@ -452,6 +452,12 @@ static void test_aes(void)
ok(size == 64, "got %u\n", size);
size = 0;
ret = pBCryptGetProperty(alg, BCRYPT_CHAINING_MODE, mode, sizeof(mode) - 1, &size, 0);
ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
ok(size == 64, "got %u\n", size);
size = 0;
memset(mode, 0, sizeof(mode));
ret = pBCryptGetProperty(alg, BCRYPT_CHAINING_MODE, mode, sizeof(mode), &size, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(!lstrcmpW((const WCHAR *)mode, BCRYPT_CHAIN_MODE_CBC), "got %s\n", mode);
......
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