diff --git a/alpine-maildir-closedir.patch b/alpine-maildir-closedir.patch new file mode 100644 index 0000000..a847917 --- /dev/null +++ b/alpine-maildir-closedir.patch @@ -0,0 +1,39 @@ +--- imap/src/osdep/unix/maildir.c 2011-10-17 10:11:55.000000000 +0200 ++++ imap/src/osdep/unix/maildir.c 2011-10-17 10:39:31.000000000 +0200 +@@ -2396,7 +2396,6 @@ + || !strncmp(d->d_name, MDUIDTEMP, strlen(MDUIDTEMP))) + break; + } +- closedir(dir); + rv = d ? !strncmp(d->d_name, tmp, strlen(tmp)) : 1; + createtemp = d ? 0 : 1; + if (d && rv == 0){ /* is there a temp file that is not ours? */ +@@ -2410,6 +2409,7 @@ + unlink(tmp); + } + } ++ closedir(dir); + if(createtemp){ + FILE *fp; + sprintf(tmp,"%s/%s.%d.%lu", LOCAL->dir, MDUIDTEMP, getpid(), time(0)); +@@ -2442,7 +2442,6 @@ + if(!strncmp(d->d_name, MDUIDLAST, strlen(MDUIDLAST))) + break; + } +- closedir(dir); + createuid = d == NULL ? 1 : 0; + if(uid_last == NULL) + deleteuid++; +@@ -2473,9 +2472,10 @@ + } + } + if(deleteuid){ +- sprintf(tmp,"%s/%s", LOCAL->dir, d->d_name); ++ snprintf(tmp, sizeof(tmp), "%s/%s", LOCAL->dir, d->d_name); + unlink(tmp); + } ++ closedir(dir); + if(createuid) + maildir_write_uid(stream, (uid_last ? *uid_last : stream->uid_last), + uid_validity ? *uid_validity : time(0)); +Nur in alpine-2.00/imap/src/osdep/unix: maildir.c~. diff --git a/alpine.changes b/alpine.changes index fd53652..4454adb 100644 --- a/alpine.changes +++ b/alpine.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Oct 17 08:45:32 UTC 2011 - max@suse.com + +- Fix two instances of premature closedir() and a potential buffer + overflow in the maildir handler (alpine-maildir-closedir.patch). + ------------------------------------------------------------------- Tue Oct 11 13:10:14 UTC 2011 - max@suse.com diff --git a/alpine.spec b/alpine.spec index acec08a..8954f56 100644 --- a/alpine.spec +++ b/alpine.spec @@ -66,6 +66,7 @@ Patch4: fix-implicit.patch Patch5: alpine-gcc44.diff Patch6: alpine-2.00-as_needed.patch Patch7: alpine-month_name-utf8.patch +Patch8: alpine-maildir-closedir.patch Patch10: pico-fix-spurious-undef-warnings.diff Patch20: pine-expression-warnings.diff Patch40: pico-stripwhitespace.diff @@ -164,6 +165,7 @@ fi %patch5 -p0 %patch6 -p0 %patch7 +%patch8 %patch10 -p1 %patch20 -p1 %patch40 -p1