From: Timo Sirainen Date: Mon, 24 Mar 2003 12:59:49 +0000 (+0200) Subject: FETCH BODY[part] didn't work correctly X-Git-Tag: 1.1.alpha1~4791 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=04a3a39c715e4d1a74485a50eb86eb545e2083cf;p=thirdparty%2Fdovecot%2Fcore.git FETCH BODY[part] didn't work correctly --HG-- branch : HEAD --- diff --git a/src/imap/imap-fetch-body-section.c b/src/imap/imap-fetch-body-section.c index bb59af69f0..c901898348 100644 --- a/src/imap/imap-fetch-body-section.c +++ b/src/imap/imap-fetch-body-section.c @@ -445,10 +445,16 @@ static int fetch_part_body(struct imap_fetch_context *ctx, { const char *str; int skip_cr; + uoff_t size; off_t ret; - str = t_strdup_printf("%s {%"PRIuUOFF_T"}\r\n", - ctx->prefix, part->body_size.virtual_size); + if (body->skip >= part->body_size.virtual_size) + size = 0; + else { + size = part->body_size.virtual_size - body->skip; + if (size > body->max_size) size = body->max_size; + } + str = t_strdup_printf("%s {%"PRIuUOFF_T"}\r\n", ctx->prefix, size); if (o_stream_send_str(ctx->output, str) < 0) return FALSE;