[gnome-settings-daemon/gnome-3-16] power: Fix a crash when reading invalid backlight values
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon/gnome-3-16] power: Fix a crash when reading invalid backlight values
- Date: Tue, 19 May 2015 14:16:46 +0000 (UTC)
commit 92c470a8dc73e3d9f6ccd28c5adfbf01867d485a
Author: Rui Matos <tiagomatos gmail com>
Date: Fri May 15 15:44:58 2015 +0200
power: Fix a crash when reading invalid backlight values
If atoi() returns a negative value this will be interpreted as an
error but the GError wouldn't be set which would crash us when
printing an error message.
See https://bugzilla.redhat.com/show_bug.cgi?id=1222007
https://bugzilla.gnome.org/show_bug.cgi?id=749440
plugins/power/gsd-backlight-helper.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/plugins/power/gsd-backlight-helper.c b/plugins/power/gsd-backlight-helper.c
index 0714207..00bc263 100644
--- a/plugins/power/gsd-backlight-helper.c
+++ b/plugins/power/gsd-backlight-helper.c
@@ -89,6 +89,9 @@ gsd_backlight_helper_read_value (const gchar *filename, GError **error)
value = -1;
g_free (contents);
+ if (value < 0 && *error == NULL)
+ g_set_error (error, 1, 0, "got invalid backlight value from %s", filename);
+
return value;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]