Accepting request 88143 from server:mail

Fix crashes in maildir handler

OBS-URL: https://build.opensuse.org/request/show/88143
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/alpine?expand=0&rev=25
This commit is contained in:
Sascha Peilicke 2011-10-18 11:56:30 +00:00 committed by Git OBS Bridge
parent 45bfccc746
commit 8b21e778ce
3 changed files with 47 additions and 0 deletions

View File

@ -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~.

View File

@ -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 Tue Oct 11 13:10:14 UTC 2011 - max@suse.com

View File

@ -66,6 +66,7 @@ Patch4: fix-implicit.patch
Patch5: alpine-gcc44.diff Patch5: alpine-gcc44.diff
Patch6: alpine-2.00-as_needed.patch Patch6: alpine-2.00-as_needed.patch
Patch7: alpine-month_name-utf8.patch Patch7: alpine-month_name-utf8.patch
Patch8: alpine-maildir-closedir.patch
Patch10: pico-fix-spurious-undef-warnings.diff Patch10: pico-fix-spurious-undef-warnings.diff
Patch20: pine-expression-warnings.diff Patch20: pine-expression-warnings.diff
Patch40: pico-stripwhitespace.diff Patch40: pico-stripwhitespace.diff
@ -164,6 +165,7 @@ fi
%patch5 -p0 %patch5 -p0
%patch6 -p0 %patch6 -p0
%patch7 %patch7
%patch8
%patch10 -p1 %patch10 -p1
%patch20 -p1 %patch20 -p1
%patch40 -p1 %patch40 -p1