diff --git a/lib/client/CXWindowsSecondaryScreen.cpp b/lib/client/CXWindowsSecondaryScreen.cpp index fe62e9f3..3f6c2ee3 100644 --- a/lib/client/CXWindowsSecondaryScreen.cpp +++ b/lib/client/CXWindowsSecondaryScreen.cpp @@ -917,7 +917,7 @@ void CXWindowsSecondaryScreen::updateKeycodeMap(Display* display) { // there are up to 4 keysyms per keycode - static const int numKeysyms = 4; + static const int maxKeysyms = 4; // get the number of keycodes int minKeycode, maxKeycode; @@ -930,6 +930,12 @@ CXWindowsSecondaryScreen::updateKeycodeMap(Display* display) minKeycode, numKeycodes, &keysymsPerKeycode); + // we only understand up to maxKeysyms keysyms per keycodes + int numKeysyms = keysymsPerKeycode; + if (numKeysyms > maxKeysyms) { + numKeysyms = maxKeysyms; + } + // initialize KeyCodeMask entry; m_keycodeMap.clear();