From 83ef8f965885cd16a22f19976d57ca024fa028aa Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Tue, 31 Jan 2023 23:40:22 -0800 Subject: [PATCH] [simulation] GUI: Fix buffer overflow in joystick axes copy (#5036) This was using an incorrect sizeof which would copy excessive data and overwrite the button data. --- simulation/halsim_gui/src/main/native/cpp/DriverStationGui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simulation/halsim_gui/src/main/native/cpp/DriverStationGui.cpp b/simulation/halsim_gui/src/main/native/cpp/DriverStationGui.cpp index e7271fdd6b..f75ecac299 100644 --- a/simulation/halsim_gui/src/main/native/cpp/DriverStationGui.cpp +++ b/simulation/halsim_gui/src/main/native/cpp/DriverStationGui.cpp @@ -487,7 +487,7 @@ void GlfwSystemJoystick::GetData(HALJoystickData* data, bool mapGamepad) const { } } else { std::memcpy(data->axes.axes, sysAxes, - data->axes.count * sizeof(&data->axes.axes[0])); + data->axes.count * sizeof(data->axes.axes[0])); } data->povs.count = data->desc.povCount;