From 675a30f5508e1cba2a587a7e27c6897d97bdc0d7 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 753172c0e..b8e2c489f 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -3242,8 +3242,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; }