summaryrefslogtreecommitdiff
path: root/pith/ical.c
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2017-12-24 19:13:39 -0700
committerEduardo Chappa <chappa@washington.edu>2017-12-24 19:13:39 -0700
commit5cb80f3539fd43b785638b676c7ba242bda2f75d (patch)
treeda86ca1533e21f86926db038f9932f191cefa4b4 /pith/ical.c
parent29798bd68fc0b892fce0fe49ec8859485e3b531b (diff)
downloadalpine-5cb80f3539fd43b785638b676c7ba242bda2f75d.tar.xz
* If the calendar invitation is part of the body of a message instead
of an attachment, Alpine would crash. Reported by Stefan Mueller. * In the previous situation, if a DESCRIPTION is encoded in quoted printable, it needs to be decoded twice (once as part of the calendar onvitation and another as part of the DESCRIPTION text, so when decoding we need to decode quoted-printable, then remove escapes characters, then decode quoted-printable and transform \r\n to \n. Whew!)
Diffstat (limited to 'pith/ical.c')
-rw-r--r--pith/ical.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/pith/ical.c b/pith/ical.c
index b3fe67e2..75212514 100644
--- a/pith/ical.c
+++ b/pith/ical.c
@@ -37,6 +37,7 @@ ICLINE_S *ical_cline_cpy(ICLINE_S *);
ICAL_PARAMETER_S *ical_parameter_cpy(ICAL_PARAMETER_S *param);
char *ical_get_value(char **);
+char *ical_decode(char *, unsigned short);
/* pase component */
void *ical_parse_vcalendar(char **);
@@ -231,6 +232,19 @@ ICAL_PROP_S alarm_prop[] = {
/* Finally, here begins the code. */
+char *
+ical_decode(char *text, unsigned short encoding)
+{
+ char *t;
+ unsigned long callen;
+ if(encoding == ENCQUOTEDPRINTABLE){
+ t = rfc822_qprint ((unsigned char *) text,strlen(text),&callen);
+ strncpy(text, t, strlen(t));
+ }
+ return text;
+}
+
+
/* Return code:
0 - if no errors
-1 - if an error occured
@@ -1965,6 +1979,7 @@ ical_vevent_summary(VCALENDAR_S *vcal)
VEVENT_S *vevent;
GEN_ICLINE_S *gicl;
ICLINE_S *icl;
+ char *k;
if(vcal == NULL) return NULL;
@@ -2170,7 +2185,7 @@ ical_vevent_summary(VCALENDAR_S *vcal)
role && *role ? role : "",
role && *role ? " " : "",
partstat ? partstat : _("[Unknown Reply]"),
- partstat ? " " : "",
+ " ",
cn && *cn ? cn : "",
cn && *cn ? " " : "",
mailto ? mailto : _("Unknown address"));
@@ -2228,13 +2243,13 @@ ical_vevent_summary(VCALENDAR_S *vcal)
}
if(*t == ','){
*u = '\0';
- rv->description[i++] = cpystr(s);
+ rv->description[i++] = cpystr(ical_decode(s, vcal->encoding));
s = u = t+1;
} else
*u++ = *t;
}
*u = '\0';
- rv->description[i++] = cpystr(s);
+ rv->description[i++] = cpystr(ical_decode(s, vcal->encoding));
rv->description[i] = NULL;
fs_give((void **)&v);
} /* end of if(description) */