diff options
author | Eduardo Chappa <chappa@washington.edu> | 2023-01-11 09:50:30 -0700 |
---|---|---|
committer | Eduardo Chappa <chappa@washington.edu> | 2023-01-11 09:50:30 -0700 |
commit | c92df42385798c13c3d6aa688fe307663d7c049a (patch) | |
tree | 6f5a7054690e11b14b0ab5d5870d6dea214b9b3f | |
parent | a809f07ffdc447dd9adc4c4514254b9edefdf72c (diff) | |
download | alpine-c92df42385798c13c3d6aa688fe307663d7c049a.tar.xz |
* Fix a crash in Alpine due to incorrectly formated date in an ical
invitation. Reported by Ulf-Dietrich Braumann.
* Fix parsing of the DURATION field in an ical invitation. Found
in a bug report by Ulf-Dietrich Braumann.
* Fix display of the DESCRIPTION field in an ical invitation. Found
in a bug report by Ulf-Dietrich Braumann.
-rw-r--r-- | alpine/mailpart.c | 48 | ||||
-rw-r--r-- | pith/ical.c | 41 | ||||
-rw-r--r-- | pith/icaltype.h | 2 | ||||
-rw-r--r-- | pith/pine.hlp | 8 |
4 files changed, 47 insertions, 52 deletions
diff --git a/alpine/mailpart.c b/alpine/mailpart.c index 1c69391f..9adad9df 100644 --- a/alpine/mailpart.c +++ b/alpine/mailpart.c @@ -3199,32 +3199,30 @@ display_vevent_summary(long int msgno, ATTACH_S *a, int flags, int depth) int j, empty; so_puts(in_store, "\015\012"); - - for(i = 0; vesy->description[i] != NULL; i++){ - so_puts(in_store, _("Description: ")); - /* Check if empty description */ - empty = 1; - for(j =0; empty == 1 && vesy->description[i][j] != '\0'; j++){ - c = vesy->description[i][j]; - if(c != '\n' && c != ' ' && c != '\t') - empty = 0; - } - if(empty){ - so_puts(in_store, _("[ No description provided ]")); - so_puts(in_store, "\015\012"); - } - else { - for(j =0; vesy->description[i][j] != '\0'; j++){ - c = vesy->description[i][j]; - if(c == '\n'){ - so_puts(in_store, "\015\012"); - continue; - } - so_writec(c, in_store); - } + so_puts(in_store, _("Description: ")); + + /* Check if empty description */ + empty = 1; + for(j = 0; empty == 1 && vesy->description[j] != '\0'; j++){ + c = vesy->description[j]; + if(c != '\n' && c != ' ' && c != '\t') + empty = 0; + } + if(empty){ + so_puts(in_store, _("[ No description provided ]")); + so_puts(in_store, "\015\012"); + } + else { + for(j =0; vesy->description[j] != '\0'; j++){ + c = vesy->description[j]; + if(c == '\n'){ + so_puts(in_store, "\015\012"); + continue; + } + so_writec(c, in_store); } - so_puts(in_store, "\015\012"); - } + } + so_puts(in_store, "\015\012"); } if(vesy->attendee){ diff --git a/pith/ical.c b/pith/ical.c index 64817e64..98080b5b 100644 --- a/pith/ical.c +++ b/pith/ical.c @@ -1783,19 +1783,19 @@ ical_parse_duration(char *value, ICAL_DURATION_S *ic_d) for(j = i; value[j] != '\0' && value[j] != ','; j++){ if(!isdigit(value[j])) switch(value[j]){ - case 'W': ic_d->weeks = ical_get_number_value(value, i, j-1); + case 'W': ic_d->weeks = ical_get_number_value(value, i, j); i = ++j; break; - case 'D': ic_d->days = ical_get_number_value(value, i, j-1); + case 'D': ic_d->days = ical_get_number_value(value, i, j); i = ++j; break; - case 'H': ic_d->hours = ical_get_number_value(value, i, j-1); + case 'H': ic_d->hours = ical_get_number_value(value, i, j); i = ++j; break; - case 'M': ic_d->minutes = ical_get_number_value(value, i, j-1); + case 'M': ic_d->minutes = ical_get_number_value(value, i, j); i = ++j; break; - case 'S': ic_d->seconds = ical_get_number_value(value, i, j-1); + case 'S': ic_d->seconds = ical_get_number_value(value, i, j); i = ++j; break; case 'T': i = j + 1; @@ -2258,9 +2258,10 @@ ical_vevent_summary(VCALENDAR_S *vcal) int icd; /* ical date return value */ memset((void *)&ic_date, 0, sizeof(struct tm)); - icd = ical_parse_date(icl->value, &ic_date) & 0x00fff; + icd = ical_parse_date(icl->value, &ic_date); tzid = ical_get_tzid(icl->param); if(icd >= 0){ + icd &= 0x00fff; ic_date.tm_wday = ical_day_of_week(ic_date); if(ic_date.tm_isdst & ICAL_DATE_TIME_GMT){ /* GMT time */ ic_date.tm_isdst = dst; @@ -2355,9 +2356,10 @@ ical_vevent_summary(VCALENDAR_S *vcal) int icd; memset((void *)&ic_date, 0, sizeof(struct tm)); - icd = ical_parse_date(icl->value, &ic_date) & 0x00fff; + icd = ical_parse_date(icl->value, &ic_date); tzid = ical_get_tzid(icl->param); if(icd >= 0){ + icd &= 0x00fff; ic_date.tm_wday = ical_day_of_week(ic_date); if(ic_date.tm_isdst & ICAL_DATE_TIME_GMT){ /* GMT time */ ic_date.tm_isdst = dst; @@ -2412,9 +2414,10 @@ ical_vevent_summary(VCALENDAR_S *vcal) int icd; memset((void *)&ic_date, 0, sizeof(struct tm)); - icd = ical_parse_date(icl->value, &ic_date) & 0x00fff; + icd = ical_parse_date(icl->value, &ic_date); tzid = ical_get_tzid(icl->param); if(icd >= 0){ + icd &= 0x00fff; ic_date.tm_wday = ical_day_of_week(ic_date); if(ic_date.tm_isdst & ICAL_DATE_TIME_GMT){ /* GMT time */ ic_date.tm_isdst = dst; @@ -2525,7 +2528,7 @@ ical_vevent_summary(VCALENDAR_S *vcal) if((icl = (ICLINE_S *) vevent->prop[EvDescription]) != NULL){ char *s, *t, *u, *v; - int i, escaped; + int escaped; if(icl->value == NULL){ free_vevent_summary(&rv); @@ -2534,7 +2537,7 @@ ical_vevent_summary(VCALENDAR_S *vcal) v = cpystr(icl->value); /* process a copy of icl->value */ - for(i = 1, escaped = 0, s = v; s && *s; s++){ + for(escaped = 0, s = v; s && *s; s++){ if(*s == '\\' && escaped == 0){ escaped = 1; continue; } if(escaped){ if(!(*s == '\\' || *s == ',' || *s == 'n' || *s == 'N' || *s == ';')){ @@ -2545,11 +2548,8 @@ ical_vevent_summary(VCALENDAR_S *vcal) escaped = 0; continue; } - if(*s == ',') i++; /* a non-scaped comma is a new value for text */ } - rv->description = fs_get((i+1)*sizeof(unsigned char *)); - i = 0; for (s = t = u = v, escaped = 0; *t != '\0'; t++){ if(*t == '\\' && escaped == 0){ escaped = 1; continue; } if(escaped){ @@ -2570,16 +2570,10 @@ ical_vevent_summary(VCALENDAR_S *vcal) escaped = 0; continue; } - if(*t == ','){ - *u = '\0'; - rv->description[i++] = (unsigned char *) cpystr((char *) ical_decode(s, vcal->encoding)); - s = u = t+1; - } else - *u++ = *t; + *u++ = *t; } *u = '\0'; - rv->description[i++] = (unsigned char *) cpystr((char *) ical_decode(s, vcal->encoding)); - rv->description[i] = NULL; + rv->description = (unsigned char *) cpystr((char *) ical_decode(s, vcal->encoding)); fs_give((void **)&v); } /* end of if(description) */ /* last instruction of the loop */ @@ -2618,11 +2612,8 @@ free_vevent_summary(VEVENT_SUMMARY_S **vesy) fs_give((void **) &(*vesy)->attendee[i]); fs_give((void **) &(*vesy)->attendee); } - if((*vesy)->description){ - for(i = 0; (*vesy)->description[i] != NULL; i++) - fs_give((void **) &(*vesy)->description[i]); + if((*vesy)->description) fs_give((void **) &(*vesy)->description); - } if((*vesy)->next) free_vevent_summary(&(*vesy)->next); fs_give((void **) vesy); } diff --git a/pith/icaltype.h b/pith/icaltype.h index c50a409c..23e3cafd 100644 --- a/pith/icaltype.h +++ b/pith/icaltype.h @@ -447,7 +447,7 @@ typedef struct vevent_summary_s { char *dtstamp; char **duration; char **attendee; - unsigned char **description; + unsigned char *description; struct vevent_summary_s *next; } VEVENT_SUMMARY_S; diff --git a/pith/pine.hlp b/pith/pine.hlp index 93e33784..73b5d7c4 100644 --- a/pith/pine.hlp +++ b/pith/pine.hlp @@ -147,7 +147,7 @@ with help text for the config screen and the composer that didn't have any reasonable place to be called from. Dummy change to get revision in pine.hlp ============= h_revision ================= -Alpine Commit 669 2022-12-13 18:51:11 +Alpine Commit 670 2023-01-11 09:49:34 ============= h_news ================= <HTML> <HEAD> @@ -218,6 +218,12 @@ does not allow a user to input their password. Reported by Michelle McPeek. <LI> Crash in Alpine after a user tried to repaint the screen after failing to select a rule from a menu. Reported by Peter Tirsek. Crash also reproducible when selecting by keyword or charset. +<LI> Fix a crash in Alpine due to incorrectly formated date in an ical + invitation. Reported by Ulf-Dietrich Braumann. +<LI> Fix parsing of the DURATION field in an ical invitation. Found + in a bug report by Ulf-Dietrich Braumann. +<LI> Fix display of the DESCRIPTION field in an ical invitation. Found + in a bug report by Ulf-Dietrich Braumann. </UL> <P>Version 2.26 adds new features and addresses bugs found in previous |