[dovecot-cvs] dovecot/src/lib-mail message-parser.c,1.79,1.80
tss at dovecot.org
tss at dovecot.org
Tue Feb 6 13:42:56 UTC 2007
Update of /var/lib/cvs/dovecot/src/lib-mail
In directory talvi:/tmp/cvs-serv25622
Modified Files:
message-parser.c
Log Message:
Inifinite looping fixes
Index: message-parser.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-mail/message-parser.c,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -d -r1.79 -r1.80
--- message-parser.c 6 Feb 2007 13:24:42 -0000 1.79
+++ message-parser.c 6 Feb 2007 13:42:54 -0000 1.80
@@ -101,17 +101,23 @@
static int message_parser_read_more(struct message_parser_ctx *ctx,
struct message_block *block_r)
{
+ int ret;
+
if (ctx->skip > 0) {
i_stream_skip(ctx->input, ctx->skip);
ctx->skip = 0;
}
- if (i_stream_read_data(ctx->input, &block_r->data,
- &block_r->size, ctx->want_count) == -1)
+ ret = i_stream_read_data(ctx->input, &block_r->data,
+ &block_r->size, ctx->want_count);
+ if (ret == -1)
return -1;
- if (block_r->size == 0) {
- i_assert(!ctx->input->blocking);
- return 0;
+
+ if (ret == 0) {
+ if (!ctx->input->eof) {
+ i_assert(!ctx->input->blocking);
+ return 0;
+ }
}
ctx->want_count = 1;
@@ -328,6 +334,8 @@
&boundary);
if (ret >= 0) {
/* found / need more data */
+ if (ret == 0 && boundary_start == 0)
+ ctx->want_count += i + 1;
break;
}
}
More information about the dovecot-cvs
mailing list