From 7dd92b77bc29a8d97eaed08f016543a5766411ca Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 6 May 2025 15:43:26 +0200 Subject: [PATCH] (!1967) dix: NULL-protection in GestureAddRegularListener() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit protect against the (unlikely) case that inputMasks == NULL. | ../dix/gestures.c: In function ‘GestureAddRegularListener’: | ../include/list.h:376:21: warning: dereference of NULL ‘0’ [CWE-476] [-Wanalyzer-null-dereference] | 376 | for (_entry = _list; _entry; _entry = (_entry)->_member) | ../dix/gestures.c:241:9: note: in expansion of macro ‘nt_list_for_each_entry’ | 241 | nt_list_for_each_entry(iclients, inputMasks->inputClients, next) { | | ^~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Enrico Weigelt, metux IT consult --- dix/gestures.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dix/gestures.c b/dix/gestures.c index 038bc357c..31179a9f7 100644 --- a/dix/gestures.c +++ b/dix/gestures.c @@ -236,7 +236,7 @@ GestureAddRegularListener(DeviceIntPtr dev, GestureInfoPtr gi, WindowPtr win, In 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;