[gnome-settings-daemon] wacom: Fix NULL pointer dereference



commit dd1a1765542493bf5da20bfef94dbe9e0bfad8bc
Author: Jason Gerecke <killertofu gmail com>
Date:   Mon Jan 23 15:41:45 2012 -0800

    wacom: Fix NULL pointer dereference
    
    Fixes a potential NULL pointer dereference in the set_display_
    by_output function. If provided with a NULL, we assume that the
    mapping should be reset to the default of ["", "", ""].
    
    https://bugzilla.gnome.org/show_bug.cgi?id=668545

 plugins/wacom/gsd-wacom-device.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/plugins/wacom/gsd-wacom-device.c b/plugins/wacom/gsd-wacom-device.c
index 04b5305..ad5c841 100644
--- a/plugins/wacom/gsd-wacom-device.c
+++ b/plugins/wacom/gsd-wacom-device.c
@@ -519,10 +519,19 @@ set_display_by_output (GsdWacomDevice    *device,
 		return;
 	}
 
-	o_vendor = g_malloc0 (4);
-	gnome_rr_output_info_get_vendor (rr_output_info, o_vendor);
-	o_product = g_strdup_printf ("%d", gnome_rr_output_info_get_product (rr_output_info));
-	o_serial  = g_strdup_printf ("%d", gnome_rr_output_info_get_serial  (rr_output_info));
+	if (rr_output_info == NULL)
+	{
+		o_vendor  = g_strdup ("");
+		o_product = g_strdup ("");
+		o_serial  = g_strdup ("");
+	}
+	else
+	{
+		o_vendor = g_malloc0 (4);
+		gnome_rr_output_info_get_vendor (rr_output_info, o_vendor);
+		o_product = g_strdup_printf ("%d", gnome_rr_output_info_get_product (rr_output_info));
+		o_serial  = g_strdup_printf ("%d", gnome_rr_output_info_get_serial  (rr_output_info));
+	}
 
 	values[0] = o_vendor;
 	values[1] = o_product;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]