From: Paul Gofman pgofman@codeweavers.com
--- dlls/setupapi/devinst.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c index 9a02692350f..6b6c4054653 100644 --- a/dlls/setupapi/devinst.c +++ b/dlls/setupapi/devinst.c @@ -4362,7 +4362,7 @@ static CONFIGRET get_device_id_list(const WCHAR *filter, WCHAR *buffer, ULONG *l p = buffer; for (i = 0; SetupDiEnumDeviceInfo(set, i, &device); ++i) { - ret = SetupDiGetDeviceInstanceIdW(set, &device, id, sizeof(id), NULL); + ret = SetupDiGetDeviceInstanceIdW(set, &device, id, sizeof(id) / sizeof(*id), NULL); if (!ret) continue; id_len = wcslen(id) + 1; needed += id_len;
From: Paul Gofman pgofman@codeweavers.com
--- dlls/setupapi/devinst.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c index 6b6c4054653..b0d0851878e 100644 --- a/dlls/setupapi/devinst.c +++ b/dlls/setupapi/devinst.c @@ -4316,8 +4316,8 @@ static CONFIGRET get_device_id_list(const WCHAR *filter, WCHAR *buffer, ULONG *l GUID guid, *pguid = NULL; unsigned int i, id_len; ULONG query_flags = 0; + WCHAR id[256]; HDEVINFO set; - WCHAR id[64]; ULONG needed; WCHAR *p;
Turns out 64 is not enough for some device ids we can generate. On top of that, my commit fef9c1ba4e0c9944e9b6443c429581cae4fd6565 which introduced that code wrongly passes the buffer size (the size in bytes instead of character count) so longer ids corrupt stack instead of being skipped :(
This merge request was approved by Elizabeth Figura.
Could use ARRAY_SIZE(), but I'm not calling that a blocker.