diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2019-03-14 13:47:30 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2019-03-14 14:21:02 +0100 |
commit | a53af220a7dd90791b998aa6a7b769b86da8a0c9 (patch) | |
tree | 54cf39b7a52d98272dcb018b423b93dd68bee807 /tracker-wii/wiiyourself/wiimote.cpp | |
parent | ac879b98b7556f0329a6aad48e3d1e2a80144ef2 (diff) |
tracker/wii: fix memory errors
Issue: #876
Diffstat (limited to 'tracker-wii/wiiyourself/wiimote.cpp')
-rw-r--r-- | tracker-wii/wiiyourself/wiimote.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tracker-wii/wiiyourself/wiimote.cpp b/tracker-wii/wiiyourself/wiimote.cpp index e1e49101..e7a8ca90 100644 --- a/tracker-wii/wiiyourself/wiimote.cpp +++ b/tracker-wii/wiiyourself/wiimote.cpp @@ -255,7 +255,9 @@ bool wiimote::Connect (unsigned wiimote_index, bool force_hidwrites) { // get the buffer size for this device detail instance DWORD req_size = 0; - SetupDiGetDeviceInterfaceDetail(dev_info, &didata, NULL, 0, &req_size, NULL); + (void)SetupDiGetDeviceInterfaceDetail(dev_info, &didata, NULL, 0, &req_size, NULL); + if (req_size < sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA)) + WARN(_T("couldn't get device size for %u"), index); // (bizarre way of doing it) create a buffer large enough to hold the // fixed-size detail struct components, and the variable string size |