diff options
author | Andreas Schwab <schwab@suse.de> | 2009-01-25 18:46:08 +0100 |
---|---|---|
committer | Danny Kukawka <danny.kukawka@web.de> | 2009-01-25 18:46:08 +0100 |
commit | 336d871860710af1cb3a55234d5051f01e842e02 (patch) | |
tree | 8cd77aa394f2dc6e2d10d49e7449f783252c5afb | |
parent | 0f2a65e0f42702f5d57b990d481ba8735951b5a5 (diff) |
fixed buffer overrunhal-0_5_12-openSUSE11.1-branch
Fixed possible buffer overrun if there are invalid formated
led devices (e.g. iwl-phy0:assoc instead of correctly
iwl-phy0::assoc as the kernel documentation says).
-rw-r--r-- | hald/linux/device.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/hald/linux/device.c b/hald/linux/device.c index c1f8debf..21b9176c 100644 --- a/hald/linux/device.c +++ b/hald/linux/device.c @@ -1296,12 +1296,16 @@ leds_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_d attributes = g_strsplit_set (dev_name, ":", 0); if (attributes != NULL) { - if (attributes[0] != NULL && attributes[0][0] != '\0') - hal_device_property_set_string (d, "leds.device_name", attributes[0]); - if (attributes[1] != NULL && attributes[1][0] != '\0') - hal_device_property_set_string (d, "leds.colour", attributes[1]); - if (attributes[2] != NULL && attributes[2][0] != '\0') - hal_device_property_set_string (d, "leds.function", attributes[2]); + if (attributes[0] != NULL) { + if (attributes[0][0] != '\0') + hal_device_property_set_string (d, "leds.device_name", attributes[0]); + if (attributes[1] != NULL ) { + if (attributes[1][0] != '\0') + hal_device_property_set_string (d, "leds.colour", attributes[1]); + if (attributes[2] != NULL && attributes[2][0] != '\0') + hal_device_property_set_string (d, "leds.function", attributes[2]); + } + } } g_strfreev (attributes); } |