Blame SOURCES/evolution-data-server-3.22.7-use-after-free-component-summary-set.patch

1e20f1
diff -up evolution-data-server-3.22.7/calendar/libecal/e-cal-component.c.use-after-free-component-summary-set evolution-data-server-3.22.7/calendar/libecal/e-cal-component.c
1e20f1
--- evolution-data-server-3.22.7/calendar/libecal/e-cal-component.c.use-after-free-component-summary-set	2017-03-20 10:07:46.000000000 +0100
1e20f1
+++ evolution-data-server-3.22.7/calendar/libecal/e-cal-component.c	2017-04-12 12:37:17.319310071 +0200
1e20f1
@@ -4468,7 +4468,7 @@ e_cal_component_get_summary (ECalCompone
1e20f1
 }
1e20f1
 
1e20f1
 typedef struct {
1e20f1
-	const gchar *old_summary;
1e20f1
+	gchar *old_summary;
1e20f1
 	const gchar *new_summary;
1e20f1
 } SetAlarmDescriptionData;
1e20f1
 
1e20f1
@@ -4559,7 +4559,8 @@ e_cal_component_set_summary (ECalCompone
1e20f1
 	g_return_if_fail (summary->value != NULL);
1e20f1
 
1e20f1
 	if (priv->summary.prop) {
1e20f1
-		sadd.old_summary = icalproperty_get_summary (priv->summary.prop);
1e20f1
+		/* Make a copy, to avoid use-after-free */
1e20f1
+		sadd.old_summary = g_strdup (icalproperty_get_summary (priv->summary.prop));
1e20f1
 		icalproperty_set_summary (priv->summary.prop, (gchar *) summary->value);
1e20f1
 	} else {
1e20f1
 		sadd.old_summary = NULL;
1e20f1
@@ -4589,6 +4590,8 @@ e_cal_component_set_summary (ECalCompone
1e20f1
 	/* look for alarms that need a description */
1e20f1
 	sadd.new_summary = summary->value;
1e20f1
 	g_hash_table_foreach (priv->alarm_uid_hash, set_alarm_description_cb, &sadd);
1e20f1
+
1e20f1
+	g_free (sadd.old_summary);
1e20f1
 }
1e20f1
 
1e20f1
 /**