[packages/alpine] Rel 2. Backport three upstream memory-safety fixes
arekm
arekm at pld-linux.org
Thu Oct 29 08:23:56 CET 2026
commit e7f743752df392f228263e7c25e503b6910e784f
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Thu Oct 29 03:32:11 2026 +0100
Rel 2. Backport three upstream memory-safety fixes
alpine-ical-bad-date-crash.patch | 203 +++++++++++++++++++++++++++++++++++
alpine-index-resize-overflow.patch | 16 +++
alpine-nntp-list-empty-pattern.patch | 23 ++++
alpine.spec | 9 +-
4 files changed, 250 insertions(+), 1 deletion(-)
---
diff --git a/alpine.spec b/alpine.spec
index a7335b1..faf575a 100644
--- a/alpine.spec
+++ b/alpine.spec
@@ -8,7 +8,7 @@ Summary: University of Washington Alpine mail user agent
Summary(pl.UTF-8): Klient pocztowy Alpine z Uniwersytetu w Waszyngtonie
Name: alpine
Version: 2.26
-Release: 1
+Release: 2
Epoch: 1
License: Apache v2.0
Group: Applications/Mail
@@ -33,10 +33,14 @@ Patch8: %{name}-RFC1522_MAXW.patch
Patch10: alpine-2.23-gcc10.patch
Patch11: alpine-configure-c99.patch
Patch12: quota.patch
+Patch13: %{name}-ical-bad-date-crash.patch
+Patch14: %{name}-index-resize-overflow.patch
+Patch15: %{name}-nntp-list-empty-pattern.patch
URL: https://alpineapp.email/
BuildRequires: autoconf >= 2.69
BuildRequires: automake
BuildRequires: home-etc-devel
+BuildRequires: libntlm-devel
BuildRequires: libtool
BuildRequires: ncurses-devel
BuildRequires: openldap-devel
@@ -140,6 +144,9 @@ ajuda de acordo com o contexto está disponível.
%patch -P10 -p1
%patch -P11 -p1
%patch -P12 -p1
+%patch -P13 -p1
+%patch -P14 -p1
+%patch -P15 -p1
%build
rm -f libtool missing
diff --git a/alpine-ical-bad-date-crash.patch b/alpine-ical-bad-date-crash.patch
new file mode 100644
index 0000000..4af8396
--- /dev/null
+++ b/alpine-ical-bad-date-crash.patch
@@ -0,0 +1,203 @@
+Crash on an iCalendar invitation with a malformed date; DURATION/DESCRIPTION parsing.
+https://repo.or.cz/alpine.git/commit/c92df42385798c13c3d6aa688fe307663d7c049a
+
+diff --git a/alpine/mailpart.c b/alpine/mailpart.c
+index 1c69391..9adad9d 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 64817e6..98080b5 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 c50a409..23e3caf 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/alpine-index-resize-overflow.patch b/alpine-index-resize-overflow.patch
new file mode 100644
index 0000000..10ce5e6
--- /dev/null
+++ b/alpine-index-resize-overflow.patch
@@ -0,0 +1,16 @@
+Index screen growth resizes entry_state to lines_per_page bytes, then memsets whole structs: heap overflow.
+https://repo.or.cz/alpine.git/commit/5d9544ad4aaa3839322699e83844a527f72a1a72
+
+diff --git a/alpine/mailindx.c b/alpine/mailindx.c
+index 61f6418..5f32ad3 100644
+--- a/alpine/mailindx.c
++++ b/alpine/mailindx.c
+@@ -1240,7 +1240,7 @@ update_index(struct pine *state, struct index_state *screen)
+ }
+ else
+ fs_resize((void **)&(screen->entry_state),
+- (size_t)screen->lines_per_page);
++ (size_t)screen->lines_per_page * sizeof(struct entry_state));
+
+ for(; i < screen->lines_per_page; i++) /* init new entries */
+ memset(&screen->entry_state[i], 0, sizeof(struct entry_state));
diff --git a/alpine-nntp-list-empty-pattern.patch b/alpine-nntp-list-empty-pattern.patch
new file mode 100644
index 0000000..bc6d163
--- /dev/null
+++ b/alpine-nntp-list-empty-pattern.patch
@@ -0,0 +1,23 @@
+nntp_list reads pat[-1] for an empty pattern.
+https://repo.or.cz/alpine.git/commit/3d6c5540c8c2f4d01331de13e52790e5d7b6ac49
+
+diff --git a/imap/src/c-client/nntp.c b/imap/src/c-client/nntp.c
+index cc94911..61dd1bd 100644
+--- a/imap/src/c-client/nntp.c
++++ b/imap/src/c-client/nntp.c
+@@ -335,7 +335,6 @@ void nntp_list (MAILSTREAM *stream,char *ref,char *pat)
+ {
+ MAILSTREAM *st = stream;
+ char *s,*t,*lcl,pattern[MAILTMPLEN],name[MAILTMPLEN],wildmat[MAILTMPLEN];
+- int showuppers = pat[strlen (pat) - 1] == '%';
+ if (!*pat) {
+ if (nntp_canonicalize (ref,"*",pattern,NIL)) {
+ /* tie off name at root */
+@@ -351,6 +350,7 @@ void nntp_list (MAILSTREAM *stream,char *ref,char *pat)
+ ((nntp_send (LOCAL->nntpstream,"LIST ACTIVE",
+ wildmat[0] ? wildmat : NIL) == NNTPGLIST) ||
+ (nntp_send (LOCAL->nntpstream,"LIST",NIL) == NNTPGLIST))) {
++ int showuppers = pat[strlen (pat) - 1] == '%';
+ /* namespace format name? */
+ if (*(lcl = strchr (strcpy (name,pattern),'}') + 1) == '#') lcl += 6;
+ /* process data until we see final dot */
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/alpine.git/commitdiff/e7f743752df392f228263e7c25e503b6910e784f
More information about the pld-cvs-commit
mailing list