From 2db519141865cd504351aabf042db5bdf2ac5d96 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 24 Jun 2018 23:33:33 +0200 Subject: Check nxagentXkbInfo.EventBase before use --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'nx-X11/programs/Xserver') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 94480c45c..4c85145a9 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -2782,7 +2782,8 @@ int nxagentHandleXkbKeyboardStateEvent(XEvent *X) { XkbEvent *xkbev = (XkbEvent *) X; - if (xkbev -> type == nxagentXkbInfo.EventBase + XkbEventCode && + if (nxagentXkbInfo.EventBase != -1 && + xkbev -> type == nxagentXkbInfo.EventBase + XkbEventCode && xkbev -> any.xkb_type == XkbStateNotify) { #ifdef TEST @@ -3815,6 +3816,11 @@ int nxagentInitXkbKeyboardState(void) XkbEvent *xkbev = (XkbEvent *) &X; + if (nxagentXkbInfo.EventBase == -1) + { + return 1; + } + #ifdef TEST fprintf(stderr, "%s: Initializing XKB state.\n", __func__); #endif -- cgit v1.2.3