Package: dovecot
Severity: important
Tags: patch

Hi,

a recent addition in src/lib-storage/index/mbox/istream-raw-mbox.c:

========================================================================================
[...]
                if (pos == 2) {
                        /* we're at the end of file with CR+LF linefeeds?
                           need more data to verify it. */
                        rstream->input_peak_offset =
                                stream->istream.v_offset + pos;
                        return _read(stream);
                }
[...]
========================================================================================

makes my imap process crash, resulting in repeatedly spawned (and killed)
processes in my log file:

========================================================================================
[...]
Jul 11 15:31:04 localhost dovecot: imap-login: Login: user=<ernie>, 
method=plain, rip=127.0.0.1, lip=127.0.0.1, secured
Jul 11 15:31:04 localhost dovecot: child 31284 (imap) killed with signal 11
Jul 11 15:31:04 localhost dovecot: child 31287 (imap) killed with signal 11
Jul 11 15:31:04 localhost dovecot: imap-login: Login: user=<ernie>, 
method=plain, rip=127.0.0.1, lip=127.0.0.1, secured
Jul 11 15:31:05 localhost dovecot: imap-login: Login: user=<ernie>, 
method=plain, rip=127.0.0.1, lip=127.0.0.1, secured
Jul 11 15:31:05 localhost dovecot: child 31293 (imap) killed with signal 11
Jul 11 15:31:05 localhost dovecot: imap-login: Login: user=<ernie>, 
method=plain, rip=127.0.0.1, lip=127.0.0.1, secured
Jul 11 15:31:05 localhost dovecot: child 31296 (imap) killed with signal 11
Jul 11 15:31:05 localhost dovecot: child 31299 (imap) killed with signal 11
Jul 11 15:31:05 localhost dovecot: imap-login: Login: user=<ernie>, 
method=plain, rip=127.0.0.1, lip=127.0.0.1, secured
Jul 11 15:31:06 localhost dovecot: child 31310 (imap) killed with signal 11
Jul 11 15:31:07 localhost dovecot: imap-login: Login: user=<ernie>, 
method=plain, rip=127.0.0.1, lip=127.0.0.1, secured
Jul 11 15:31:07 localhost dovecot: imap-login: Login: user=<ernie>, 
method=plain, rip=127.0.0.1, lip=127.0.0.1, secured
Jul 11 15:31:07 localhost dovecot: child 31313 (imap) killed with signal 11
Jul 11 15:31:07 localhost dovecot: child 31316 (imap) killed with signal 11
Jul 11 15:31:07 localhost dovecot: imap-login: Login: user=<ernie>, 
method=plain, rip=127.0.0.1, lip=127.0.0.1, secured
[...]
========================================================================================

This is caused by the infinite recursive loop made by the "return 
_read(stream);"

The problem is triggered in my mbox directories because I have .svn/format
files lying around (mail under svn revision control). In this case, the file is 
2 bytes long:

========================================================================================
[EMAIL PROTECTED]:~/Mail$ hexdump -C .svn/format
00000000  34 0a                                             |4.|
00000002
========================================================================================

The attached patch (guarding against eof) is a reasonable workaround.

bye,
  Roland

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17-1-686
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_GB.UTF-8)
diff -ruN dovecot-1.0.rc2.orig/src/lib-storage/index/mbox/istream-raw-mbox.c dovecot-1.0.rc2/src/lib-storage/index/mbox/istream-raw-mbox.c
--- dovecot-1.0.rc2.orig/src/lib-storage/index/mbox/istream-raw-mbox.c	2006-06-24 22:44:09.000000000 +0200
+++ dovecot-1.0.rc2/src/lib-storage/index/mbox/istream-raw-mbox.c	2006-07-11 16:51:32.000000000 +0200
@@ -193,7 +193,7 @@
 
 	if (stream->istream.v_offset == rstream->from_offset) {
 		/* beginning of message, we haven't yet read our From-line */
-		if (pos == 2) {
+		if (pos == 2 && ! stream->istream.eof) {
 			/* we're at the end of file with CR+LF linefeeds?
 			   need more data to verify it. */
 			rstream->input_peak_offset =

Reply via email to