Skip to content

Commit 83fc1d5

Browse files
committed
"by views" and by "author" views were not escaping markup present in
the Subject and From headers.
1 parent fbbdfa7 commit 83fc1d5

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

Changelog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ Version Changes for Hypermail
44
HYPERMAIL VERSION 2.4.0:
55
============================
66

7+
2019-11-22 Jose Kahan
8+
* src/print.c
9+
printsubject() / printdates(): the "by suject" and "by dates" views
10+
were not escaping markup present in mail's Suject and From headers.
11+
712
2019-11-19 Jose Kahan
813
* src/pcre
914
Upgraded to upstream version 8.43. This fixes some autoconf issues we

src/print.c

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -788,9 +788,14 @@ void printdates(FILE *fp, struct header *hp, int year, int month, struct emailin
788788
&& (month == -1 || month_of_datenum(em->date) == month)
789789
&& !em->is_deleted
790790
&& (!subdir_email || subdir_email->subdir == em->subdir)) {
791-
792-
subject = (set_i18n) ? em->subject : convchars(em->subject, em->charset);
793-
name = (set_i18n) ? em->name : convchars(em->name,em->charset);
791+
792+
#ifdef HAVE_ICONV
793+
subject = convchars(em->subject, "utf-8");
794+
name = convchars(em->name, "utf-8");
795+
#else
796+
subject = convchars(em->subject, em->charset);
797+
name = convchars(em->name, em->charset);
798+
#endif
794799

795800
if(set_indextable) {
796801
startline = "<tr><td>";
@@ -830,11 +835,9 @@ void printdates(FILE *fp, struct header *hp, int year, int month, struct emailin
830835
set_fragment_prefix, em->msgnum, set_fragment_prefix, em->msgnum,
831836
name,
832837
break_str, date_str, endline);
833-
834-
if (!set_i18n) {
835-
free(subject);
836-
free(name);
837-
}
838+
839+
free(subject);
840+
free(name);
838841
}
839842
printdates(fp, hp->right, year, month, subdir_email, prev_date_str);
840843
}
@@ -2689,9 +2692,15 @@ void printsubjects(FILE *fp, struct header *hp, char **oldsubject,
26892692
&& (month == -1 || month_of_datenum(hp->data->date) == month)
26902693
&& !hp->data->is_deleted
26912694
&& (!subdir_email || subdir_email->subdir == hp->data->subdir)) {
2692-
subject = (set_i18n) ? hp->data->unre_subject : convchars(hp->data->unre_subject, hp->data->charset);
2693-
name = (set_i18n) ? hp->data->name : convchars(hp->data->name,hp->data->charset);
2694-
2695+
2696+
#ifdef HAVE_ICONV
2697+
subject = convchars(hp->data->unre_subject, "utf-8");
2698+
name = convchars(hp->data->name, "utf-8");
2699+
#else
2700+
subject = convchars(hp->data->subject, hp->data->charset);
2701+
name = convchars(hp->data->name, hp->data->charset);
2702+
#endif
2703+
26952704
if (strcasecmp(hp->data->unre_subject, *oldsubject)) {
26962705
if (set_indextable) {
26972706
fprintf(fp,
@@ -2732,10 +2741,8 @@ void printsubjects(FILE *fp, struct header *hp, char **oldsubject,
27322741
set_fragment_prefix, hp->data->msgnum, date_str, endline);
27332742
*oldsubject = hp->data->unre_subject;
27342743

2735-
if (!set_i18n) {
2736-
free(subject);
2737-
free(name);
2738-
}
2744+
free(subject);
2745+
free(name);
27392746
}
27402747
printsubjects(fp, hp->right, oldsubject, year, month, subdir_email);
27412748
}

0 commit comments

Comments
 (0)