[Commits] [SCM] claws branch, master, updated. 3.18.0-207-g261e507d3

wwp at claws-mail.org wwp at claws-mail.org
Wed Sep 29 16:54:16 CEST 2021


The branch, master has been updated
       via  261e507d3cb4a7e36bc2a767ecc8a640e6b2aadb (commit)
      from  6a0dae093b93a2de10034aa1cad6a11c47456e27 (commit)

Summary of changes:
 src/plugins/vcalendar/vcal_meeting_gtk.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)


- Log -----------------------------------------------------------------
commit 261e507d3cb4a7e36bc2a767ecc8a640e6b2aadb
Author: wwp <subscript at free.fr>
Date:   Wed Sep 29 16:53:08 2021 +0200

    Fix CID 1491191: use after free.
    Reworked a bit variable scopes in multisync_export() in order to avoid such issues.

diff --git a/src/plugins/vcalendar/vcal_meeting_gtk.c b/src/plugins/vcalendar/vcal_meeting_gtk.c
index 986cec09e..992434e6a 100644
--- a/src/plugins/vcalendar/vcal_meeting_gtk.c
+++ b/src/plugins/vcalendar/vcal_meeting_gtk.c
@@ -1809,8 +1809,7 @@ void multisync_export(void)
 				"multisync", NULL);
 	GSList *files = NULL;
 	GSList *cur = NULL;
-	gchar *file = NULL;
-	gchar *tmp = NULL;
+	gchar *backup_file;
 	gint i = 0;
 	icalcomponent *calendar = NULL;
 	FILE *fp;
@@ -1826,8 +1825,9 @@ void multisync_export(void)
 	
 	list = vcal_folder_get_waiting_events();
 	for (cur = list; cur; cur = cur->next) {
+		gchar *tmp = NULL;
 		VCalEvent *event = (VCalEvent *)cur->data;
-		file = g_strdup_printf("multisync%"CM_TIME_FORMAT"-%d",
+		gchar *file = g_strdup_printf("multisync%"CM_TIME_FORMAT"-%d",
 				time(NULL), i);
 
 		i++;
@@ -1852,21 +1852,21 @@ void multisync_export(void)
 
 	g_slist_free(list);
 	
-	file = g_strconcat(path, G_DIR_SEPARATOR_S, "backup_entries", NULL);
-	fp = claws_fopen(file, "wb");
-	g_free(file);
+	backup_file = g_strconcat(path, G_DIR_SEPARATOR_S, "backup_entries", NULL);
+	fp = claws_fopen(backup_file, "wb");
 	if (fp) {
 		for (cur = files; cur; cur = cur->next) {
-			file = (char *)cur->data;
+			gchar * file = (char *)cur->data;
 			if (fprintf(fp, "1 1 %s\n", file) < 0)
 				FILE_OP_ERROR(file, "fprintf");
 			g_free(file);
 		}
 		if (claws_safe_fclose(fp) == EOF)
-			FILE_OP_ERROR(file, "claws_fclose");
+			FILE_OP_ERROR(backup_file, "claws_fclose");
 	} else {
-		FILE_OP_ERROR(file, "claws_fopen");
+		FILE_OP_ERROR(backup_file, "claws_fopen");
 	}
+	g_free(backup_file);
 	g_free(path);
 	g_slist_free(files);
 }

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list