From d91121e876b65c3fcc4b5c31e6a7ed66b8f064d3 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 6 May 2025 17:37:05 +0200 Subject: [PATCH] =?UTF-8?q?Xi:=20exevents:=20NULL=20protection=20in=20?= =?UTF-8?q?=E2=80=98DeviceEventSuppressForWindow()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Protect against `inputMasks` could be NULL. | ../Xi/exevents.c: In function ‘DeviceEventSuppressForWindow’: | ../Xi/exevents.c:3246:32: warning: dereference of NULL ‘inputMasks’ [CWE-476] [-Wanalyzer-null-dereference] | 3246 | FreeResource(inputMasks->inputClients->resource, X11_RESTYPE_NONE); | | ~~~~~~~~~~^~~~~~~~~~~~~~ Signed-off-by: Enrico Weigelt, metux IT consult --- Xi/exevents.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Xi/exevents.c b/Xi/exevents.c index 2d1d8aef7..e28b60210 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -3241,8 +3241,11 @@ DeviceEventSuppressForWindow(WindowPtr pWin, ClientPtr client, Mask mask, inputMasks->dontPropagateMask[maskndx] = mask; } RecalculateDeviceDeliverableEvents(pWin); - if (ShouldFreeInputMasks(pWin, FALSE)) + if (ShouldFreeInputMasks(pWin, FALSE)) { + BUG_RETURN_VAL(!inputMasks, BadImplementation); + BUG_RETURN_VAL(!inputMasks->inputClients, BadImplementation); FreeResource(inputMasks->inputClients->resource, X11_RESTYPE_NONE); + } return Success; }