[Commits] [SCM] claws branch, master, updated. 4.1.1-63-gdc955cc65

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


The branch, master has been updated
       via  dc955cc65c64fc3d9e2396b5330fda3df508acc0 (commit)
      from  7c1ea64fe3bb78a8f7289eb28beeb40c62d0f141 (commit)

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


- Log -----------------------------------------------------------------
commit dc955cc65c64fc3d9e2396b5330fda3df508acc0
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 537dab46f..0f5705b7f 100644
--- a/src/gtk/authors.h
+++ b/src/gtk/authors.h
@@ -303,6 +303,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