]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
mbox parsing fix
authorTimo Sirainen <tss@iki.fi>
Mon, 26 Jul 2004 14:49:01 +0000 (17:49 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 26 Jul 2004 14:49:01 +0000 (17:49 +0300)
--HG--
branch : HEAD

src/lib-storage/index/mbox/istream-raw-mbox.c

index 9f39b6bb064028b2cc0f7331dcb2623ca715d8e6..37295c80e854413e5c2d87544915da0e89109b1c 100644 (file)
@@ -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 {