From: Timo Sirainen Date: Mon, 26 Jul 2004 14:49:01 +0000 (+0300) Subject: mbox parsing fix X-Git-Tag: 1.1.alpha1~3743 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c9a94432bac24690a8adc848a5e7272903a1a2ca;p=thirdparty%2Fdovecot%2Fcore.git mbox parsing fix --HG-- branch : HEAD --- diff --git a/src/lib-storage/index/mbox/istream-raw-mbox.c b/src/lib-storage/index/mbox/istream-raw-mbox.c index 9f39b6bb06..37295c80e8 100644 --- a/src/lib-storage/index/mbox/istream-raw-mbox.c +++ b/src/lib-storage/index/mbox/istream-raw-mbox.c @@ -200,7 +200,7 @@ static ssize_t _read(struct _istream *stream) /* See if we have From-line here - note that it works right only because all characters are different in mbox_from. */ - fromp = mbox_from; from_start_pos = 0; + fromp = mbox_from; from_start_pos = (size_t)-1; eoh_char = rstream->body_offset == (uoff_t)-1 ? '\n' : '\0'; for (i = stream->pos; i < pos; i++) { if (buf[i] == eoh_char && @@ -218,7 +218,7 @@ static ssize_t _read(struct _istream *stream) i++; from_start_pos = i - 6; fromp = mbox_from; - } else if (from_start_pos != 0) { + } else if (from_start_pos != (size_t)-1) { /* we have the whole From-line here now. See if it's a valid one. */ if (mbox_from_parse(buf + from_start_pos + 6, @@ -236,7 +236,7 @@ static ssize_t _read(struct _istream *stream) from_start_pos); break; } - from_start_pos = 0; + from_start_pos = (size_t)-1; } } else { fromp = mbox_from; @@ -248,7 +248,7 @@ static ssize_t _read(struct _istream *stream) /* we want to go at least one byte further next time */ rstream->input_peak_offset = stream->istream.v_offset + i; - if (from_start_pos != 0) { + if (from_start_pos != (size_t)-1) { /* we're waiting for the \n at the end of From-line */ new_pos = from_start_pos; } else {