[PATCH 2/3] Fixed SIGSEV triggered by D-BUS.

Remigiusz Marcinkiewicz enleth at enleth.com
Sun Feb 25 06:35:36 PST 2007


A D-BUS request to add a device containing no identifier or driver caused the server to crash on a null pointer dereference. The patch adds appropriate checks to NewInputDeviceRequest().
---
 hw/xfree86/common/xf86Xinput.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 414f8f5..b1263ba 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -346,6 +346,19 @@ NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev)
         }
     }
 
+    // these two checks protect against dbus requests with no identifier or driver specified
+    if (!drv) {
+        xf86Msg(X_ERROR,
+                "No input driver specified (ignoring)\n");
+        return BadMatch;
+    }
+
+    if (!idev->identifier) {
+        xf86Msg(X_ERROR,
+                "No device identifier specified (ignoring)\n");
+        return BadMatch;
+    }
+
     if (!drv->PreInit) {
         xf86Msg(X_ERROR,
                 "Input driver `%s' has no PreInit function (ignoring)\n",
-- 
1.5.0.1




More information about the xorg mailing list