[PATCH v2] [xkb] Fix possible NULL dereference in XkbFlushLedEvents()

Tomas Carnecky tom at dbservice.com
Sun Dec 6 20:54:57 PST 2009


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 <tom at dbservice.com>
---
 xkb/xkbLEDs.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/xkb/xkbLEDs.c b/xkb/xkbLEDs.c
index 59cdba4..a9d5cfb 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);
-    }
-    bzero((char *)ed,sizeof(XkbExtensionDeviceNotify));
+    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));
+    } 
     return;
 }
 
-- 
1.6.5.5




More information about the xorg-devel mailing list