[Commits] [SCM] claws branch, gtk2, updated. 3.19.1-50-gc4b4aed43

paul at claws-mail.org paul at claws-mail.org
Thu Jun 8 09:19:22 UTC 2023


The branch, gtk2 has been updated
       via  c4b4aed435213310340cb03f2b95c8ef08a9129d (commit)
      from  7a058c0fe8df9917fdef71ce32408b5012b72ba9 (commit)

Summary of changes:
 AUTHORS           |  1 +
 src/gtk/authors.h |  1 +
 src/procheader.c  | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 57 insertions(+), 2 deletions(-)


- Log -----------------------------------------------------------------
commit c4b4aed435213310340cb03f2b95c8ef08a9129d
Author: Paul <paul at claws-mail.org>
Date:   Thu Jun 8 10:18:17 2023 +0100

    fix bug 4679, 'The correct date header is interpreted incorrectly to display strange date.'
    
    patch by Takayuki Sakaguchi

diff --git a/AUTHORS b/AUTHORS
index b822e4772..5a7f0fed7 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -345,3 +345,4 @@ contributors (in addition to the above; based on Changelog)
 	JP Guillonneau
 	Viatrix
 	Roland Haas
+	Sakaguchi Takayuki
diff --git a/src/gtk/authors.h b/src/gtk/authors.h
index 57402cfa4..123b95566 100644
--- a/src/gtk/authors.h
+++ b/src/gtk/authors.h
@@ -302,6 +302,7 @@ static char *CONTRIBS_LIST[] = {
 "TOGAWA",
 "Tajiri",
 "Takahashi",
+"Sakaguchi Takayuki",
 "Tanaka",
 "Shimamoto \"Neko\" Tatsuya",
 "Timo Teräs",
diff --git a/src/procheader.c b/src/procheader.c
index 220a808a9..4e57f5ad5 100644
--- a/src/procheader.c
+++ b/src/procheader.c
@@ -912,7 +912,56 @@ gchar *procheader_get_fromname(const gchar *str)
 	return name;
 }
 
-static gint procheader_scan_date_string(const gchar *str,
+static gint procheader_remove_comment_in_date_string(gchar *o_str)
+{
+	gchar str[strlen(o_str)+1];
+	int i, j = 0;
+	int in_comment_nest_level = 0;
+	gboolean flag_escape_backslash = FALSE;
+
+	for (i=0; i < strlen(o_str); i++) {
+		switch (o_str[i]) {
+		case '(':
+			in_comment_nest_level++;
+			if (in_comment_nest_level > 16) {
+				str[j] = '\0';
+				return TRUE;
+			}
+			continue;
+		case '\\':
+			if (in_comment_nest_level > 0) {
+				flag_escape_backslash = TRUE;
+				continue;
+			}
+			break;
+		case ')':
+			if (flag_escape_backslash == TRUE) {
+				flag_escape_backslash = FALSE;
+				continue;
+			}
+			in_comment_nest_level--;
+			if (in_comment_nest_level < 0) {
+				str[j] = '\0';
+				return TRUE;
+			}
+			continue;
+		default:
+			if (in_comment_nest_level > 0) {
+				if (flag_escape_backslash == TRUE)
+					flag_escape_backslash = FALSE;
+				continue;
+			}
+			break;
+		}
+		str[j++] = o_str[i];
+	}
+	str[j] = '\0';
+	strcpy(o_str, str);
+	return TRUE;
+}
+
+
+static gint procheader_scan_date_string(const gchar *o_str,
 					gchar *weekday, gint *day,
 					gchar *month, gint *year,
 					gint *hh, gint *mm, gint *ss,
@@ -924,9 +973,13 @@ static gint procheader_scan_date_string(const gchar *str,
 	gint zone1 = 0, zone2 = 0;
 	gchar offset_sign, zonestr[7];
 	gchar sep1;
+	gchar str[strlen(o_str)+1];
 
-	if (str == NULL)
+	if (o_str == NULL)
 		return -1;
+	strcpy(str, o_str);
+	if (strchr(str, '(') != NULL)
+		procheader_remove_comment_in_date_string(str);
 
 	result = sscanf(str, "%10s %d %9s %d %2d:%2d:%2d %6s",
 			weekday, day, month, year, hh, mm, ss, zone);

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list