From 886140787852c660978a9bb3abc7cc2702cbaed1 Mon Sep 17 00:00:00 2001 From: Tomas Carnecky Date: Mon, 7 Dec 2009 05:54:57 +0100 Subject: Fix possible NULL dereference in XkbFlushLedEvents() Through some code paths it is possible that NULL is being passed in the 'ed' parameter to XkbFlushLedEvents(). Make sure we don't pass it along to bzero(). Signed-off-by: Tomas Carnecky Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer --- xkb/xkbLEDs.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/xkb/xkbLEDs.c b/xkb/xkbLEDs.c index 59cdba416..6ca80d784 100644 --- a/xkb/xkbLEDs.c +++ b/xkb/xkbLEDs.c @@ -745,12 +745,14 @@ XkbFlushLedEvents( DeviceIntPtr dev, XkbDDXAccessXBeep(dev, _BEEP_LED_OFF, XkbAccessXFeedbackMask); } } - if (ed && (ed->reason)) { - if ((dev!=kbd)&&(ed->reason&XkbXI_IndicatorStateMask)) - XkbDDXUpdateDeviceIndicators(dev,sli,sli->effectiveState); - XkbSendExtensionDeviceNotify(dev,cause->client,ed); + if (ed) { + if (ed->reason) { + if ((dev!=kbd)&&(ed->reason&XkbXI_IndicatorStateMask)) + XkbDDXUpdateDeviceIndicators(dev,sli,sli->effectiveState); + XkbSendExtensionDeviceNotify(dev,cause->client,ed); + } + bzero((char *)ed,sizeof(XkbExtensionDeviceNotify)); } - bzero((char *)ed,sizeof(XkbExtensionDeviceNotify)); return; } -- cgit v1.2.3