dix: NULL-protection in GestureAddRegularListener()

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 <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-05-06 15:43:26 +02:00
parent f1ba454733
commit 1e47ef4006

View File

@ -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;