From 654c9c1f3d729c6b15e3028e058d8cc2f856eca6 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 6 May 2025 14:16:29 +0200 Subject: [PATCH] dix: touch: NULL-protection in TouchAddRegularListener() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit protect against the (unlikely) case that inputMasks == NULL. | ../dix/touch.c: In function ‘TouchAddRegularListener’: | ../include/list.h:376:21: warning: dereference of NULL ‘0’ [CWE-476] [-Wanalyzer-null-dereference] | 376 | for (_entry = _list; _entry; _entry = (_entry)->_member) | ../dix/touch.c:766:9: note: in expansion of macro ‘nt_list_for_each_entry’ | 766 | nt_list_for_each_entry(iclients, inputMasks->inputClients, next) { | | ^~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Enrico Weigelt, metux IT consult --- dix/touch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dix/touch.c b/dix/touch.c index 85463388c..1c0204cb8 100644 --- a/dix/touch.c +++ b/dix/touch.c @@ -760,7 +760,7 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti, inputMasks = wOtherInputMasks(win); - if (mask & EVENT_XI2_MASK) { + if ((mask & EVENT_XI2_MASK) && (inputMasks != NULL)) { nt_list_for_each_entry(iclients, inputMasks->inputClients, next) { if (!xi2mask_isset(iclients->xi2mask, dev, evtype)) continue; @@ -774,7 +774,7 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti, } } - if (mask & EVENT_XI1_MASK) { + if ((mask & EVENT_XI1_MASK) && (inputMasks != NULL)) { int xitype = GetXIType(TouchGetPointerEventType(ev)); Mask xi_filter = event_get_filter_from_type(dev, xitype);