blob: b34a1e9be212000ee2ef3c3b681aaad7a14d1a7f [file] [log] [blame]
From 1eb2d3b7149eb9b9eda30f1b324092b66865694d Mon Sep 17 00:00:00 2001
From: Alex Deymo <deymo@chromium.org>
Date: Mon, 10 Jun 2013 15:49:16 -0700
Subject: [PATCH] playstation: Prevents the playstation-plugin to crash.
If the udev property HID_ID is not set for a device, the playstation
peripheral plugin will crash with a SIGSEGV on a NULL address while
trying to parse the non-existant HID_ID address.
This patch makes the plugin to fail with an error message instead of
crashing.
---
plugins/playstation-peripheral.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/plugins/playstation-peripheral.c b/plugins/playstation-peripheral.c
index c5af82e..ceffaaf 100644
--- a/plugins/playstation-peripheral.c
+++ b/plugins/playstation-peripheral.c
@@ -218,6 +218,10 @@ static void handle_device_plug(struct udev_device *udevice)
}
hid_id = udev_device_get_property_value(hid_parent, "HID_ID");
+ if (!hid_id) {
+ error("No HID_ID found");
+ return;
+ }
DBG("HID_ID: %s", hid_id);
peripheral = find_playstation_peripheral(hid_id);
--
1.8.3