From 08431d0684f9a1edf199f6c6060d2bef1ac78399 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Thu, 25 Aug 2022 15:39:36 -0700 Subject: XInput_find_display: Don't dereference NULL dpyinfo Unlikely, but could happen if calloc fails in XextAddDisplay() Relies on XextHasExtension(i) macro from which checks for ((i) && ((i)->codes)) Fixes: #15 Signed-off-by: Alan Coopersmith --- src/XExtInt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/XExtInt.c') diff --git a/src/XExtInt.c b/src/XExtInt.c index 2e2a510..06474b2 100644 --- a/src/XExtInt.c +++ b/src/XExtInt.c @@ -230,7 +230,7 @@ XExtDisplayInfo *XInput_find_display (Display *dpy) xinput_extension_name, &xinput_extension_hooks, nevents, NULL); - if (dpyinfo->codes) /* NULL if XI doesn't exist on the server */ + if (XextHasExtension(dpyinfo)) /* skip if XI doesn't exist on the server */ { XESetWireToEventCookie(dpy, dpyinfo->codes->major_opcode, XInputWireToCookie); XESetCopyEventCookie(dpy, dpyinfo->codes->major_opcode, XInputCopyCookie); -- cgit v1.2.3