From a53af220a7dd90791b998aa6a7b769b86da8a0c9 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 14 Mar 2019 13:47:30 +0100 Subject: tracker/wii: fix memory errors Issue: #876 --- tracker-wii/wiiyourself/wiimote.cpp | 4 +++- tracker-wii/wiiyourself/wiimote.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'tracker-wii/wiiyourself') 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 diff --git a/tracker-wii/wiiyourself/wiimote.h b/tracker-wii/wiiyourself/wiimote.h index 3588b7c7..27551c76 100644 --- a/tracker-wii/wiiyourself/wiimote.h +++ b/tracker-wii/wiiyourself/wiimote.h @@ -10,6 +10,7 @@ #pragma once +#undef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #include #include // auto Unicode/Ansi support -- cgit v1.2.3