Zhiyi Zhang (@zhiyi) commented about dlls/gdi32/tests/driver.c:
skip("D3DKMTEnumAdapters2() is unavailable.\n");
return;
- }
- /* Invalid parameters */
- status = pD3DKMTEnumAdapters2(NULL);
- ok(status == STATUS_INVALID_PARAMETER, "Got unexpected return code %#lx.\n", status);
- /* Query the array to allocate */
- memset(&enum_adapters_2_desc, 0, sizeof(enum_adapters_2_desc));
- status = pD3DKMTEnumAdapters2(&enum_adapters_2_desc);
- ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
- ok(enum_adapters_2_desc.NumAdapters, "Expect not zero.\n");
- /* Allocate the array */
- enum_adapters_2_desc.pAdapters = calloc(enum_adapters_2_desc.NumAdapters + 1, sizeof(D3DKMT_ADAPTERINFO));
Why enum_adapters_2_desc.NumAdapters + 1 and not enum_adapters_2_desc.NumAdapters? I don't think it's necessary to check buffer that is out of range.