[Commits] [SCM] claws branch, gtk3, updated. 3.99.0-104-gbb17a3e4c

colin at claws-mail.org colin at claws-mail.org
Mon May 24 11:42:01 CEST 2021


The branch, gtk3 has been updated
       via  bb17a3e4c4b6c5c9b89c507553150ec5db0bb3de (commit)
       via  0630129bc9f4bb740867699fea56e795ae887e78 (commit)
       via  93c1503de4633bf15b730ebfa44a958e57649a4f (commit)
      from  fa3c6f74e2217af644520034c45ef8cb432934ce (commit)

Summary of changes:
 src/common/utils.c |  8 +++++---
 src/summaryview.c  | 21 +++++++++++----------
 2 files changed, 16 insertions(+), 13 deletions(-)


- Log -----------------------------------------------------------------
commit bb17a3e4c4b6c5c9b89c507553150ec5db0bb3de
Author: Colin Leroy <colin at colino.net>
Date:   Mon May 24 10:30:58 2021 +0200

    Fix use after free

diff --git a/src/summaryview.c b/src/summaryview.c
index 0cee051af..0c2c567d6 100644
--- a/src/summaryview.c
+++ b/src/summaryview.c
@@ -4986,18 +4986,18 @@ void summary_save_as(SummaryView *summaryview)
 	manage_window_focus_in(summaryview->window, NULL, NULL);
 
 	if (filename && !g_utf8_validate(filename, -1, NULL)) {
-		gchar *oldstr = filename;
-		filename = conv_codeset_strdup(filename,
+		gchar *converted_filename = conv_codeset_strdup(filename,
 					       conv_get_locale_charset_str(),
 					       CS_UTF_8);
-		if (!filename) {
+		if (!converted_filename) {
 			g_warning("summary_save_as(): failed to convert character set.");
-			filename = g_strdup(oldstr);
+		} else {
+			g_free(filename);
+			filename = converted_filename;
 		}
-		dest = filename;
-		g_free(filename);
-	} else
-		dest = filename;
+	}
+
+	dest = filename;
 	filename = NULL;
 	if (!dest) return;
 	if (prefs_common.attach_save_dir && *prefs_common.attach_save_dir)

commit 0630129bc9f4bb740867699fea56e795ae887e78
Author: Colin Leroy <colin at colino.net>
Date:   Mon May 24 10:31:44 2021 +0200

    Fix possible double free

diff --git a/src/summaryview.c b/src/summaryview.c
index e41bd846c..0cee051af 100644
--- a/src/summaryview.c
+++ b/src/summaryview.c
@@ -5037,10 +5037,11 @@ void summary_save_as(SummaryView *summaryview)
 			msginfo = gtk_cmctree_node_get_row_data(ctree, GTK_CMCTREE_NODE(item->data));
 			if (!msginfo) break;
 			src = procmsg_get_message_file(msginfo);
-			if (append_file(src, dest, TRUE) < 0)
+			if (append_file(src, dest, TRUE) < 0) {
 				alertpanel_error(_("Couldn't save the file '%s'."), tmp);
+			}
+			g_free(src);
 		}
-		g_free(src);
 	}
 
 	filedir = g_path_get_dirname(dest);

commit 93c1503de4633bf15b730ebfa44a958e57649a4f
Author: Colin Leroy <colin at colino.net>
Date:   Mon May 24 10:32:29 2021 +0200

    Fix email detection on dnd with large headers

diff --git a/src/common/utils.c b/src/common/utils.c
index 19ef5ab88..e7b80ab50 100644
--- a/src/common/utils.c
+++ b/src/common/utils.c
@@ -4009,13 +4009,12 @@ gboolean file_is_email (const gchar *filename)
 {
 	FILE *fp = NULL;
 	gchar buffer[2048];
-	gint i = 0;
 	gint score = 0;
 	if (filename == NULL)
 		return FALSE;
 	if ((fp = claws_fopen(filename, "rb")) == NULL)
 		return FALSE;
-	while (i < 60 && score < 3
+	while (score < 3
 	       && claws_fgets(buffer, sizeof (buffer), fp) != NULL) {
 		if (!strncmp(buffer, "From:", strlen("From:")))
 			score++;
@@ -4025,7 +4024,10 @@ gboolean file_is_email (const gchar *filename)
 			score++;
 		else if (!strncmp(buffer, "Subject:", strlen("Subject:")))
 			score++;
-		i++;
+		else if (!strcmp(buffer, "\r\n")) {
+			debug_print("End of headers\n");
+			break;
+		}
 	}
 	claws_fclose(fp);
 	return (score >= 3);

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list