From 7555a4b8db5a15ddd1bc8015caf3905f768875ce Mon Sep 17 00:00:00 2001 From: curt Date: Tue, 6 Mar 2001 23:03:06 +0000 Subject: [PATCH] Added some sanity checking on max number of bottons and axes. --- src/Joystick/joystick.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Joystick/joystick.cxx b/src/Joystick/joystick.cxx index 1ce30fa79..fd8b29c59 100644 --- a/src/Joystick/joystick.cxx +++ b/src/Joystick/joystick.cxx @@ -158,11 +158,13 @@ fgJoystickInit() JOYCAPS jsCaps ; joyGetDevCaps( i, &jsCaps, sizeof(jsCaps) ); int nbuttons = jsCaps.wNumButtons; + if (nbuttons > MAX_BUTTONS) nbuttons = MAX_BUTTONS; #else int nbuttons = MAX_BUTTONS; #endif int naxes = js->getNumAxes(); + if (naxes > MAX_AXES) naxes = MAX_AXES; joysticks[i].naxes = naxes; joysticks[i].nbuttons = nbuttons; -- 2.39.5