Rémi Bernon (@rbernon) commented about dlls/dmime/audiopath.c:
{
WARN("Invalid size of GUIDs array\n");
hr = E_FAIL;
break;
}
pchannel_to_buffer = calloc(1, sizeof(*pchannel_to_buffer) + bytes);
if (!pchannel_to_buffer)
{
hr = E_OUTOFMEMORY;
break;
}
pchannel_to_buffer->num_of_guids = bytes / sizeof(GUID);
pchannel_to_buffer->header = header;
TRACE("number of GUIDs: %lu\n", (ULONG)pchannel_to_buffer->num_of_guids);
Looking at it again, I think `num_of_guids` should be the same as `header.dwBufferCount` so you don't really need that extra struct member?
If that's the case, I would check that `sizeof(header) + header.dwBufferCount * sizeof(GUID)` matches the size of the chunk instead of `% sizeof(GUID)`. Also I would allocate `offsetof(pchannel_to_buffer, guids[header.dwBufferCount])`.