]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
don't access uninitialized memory
authorTimo Sirainen <tss@iki.fi>
Mon, 3 May 2004 13:53:35 +0000 (16:53 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 3 May 2004 13:53:35 +0000 (16:53 +0300)
--HG--
branch : HEAD

src/imap/imap-fetch-body-section.c

index dbbb60be2c541860376baceff2d6e0d1b577032c..83e11fb5e8778df153ecde12e4a39940d7e98a12 100644 (file)
@@ -366,9 +366,9 @@ static int fetch_header_from(struct imap_fetch_context *ctx,
        t_push();
 
        /* first pass, we need at least the size */
-       if (size->virtual_size > MAX_HEADER_BUFFER_SIZE &&
-           body->max_size > MAX_HEADER_BUFFER_SIZE &&
-           !ctx->body_fetch_from_cache) {
+       if (!ctx->body_fetch_from_cache &&
+           size->virtual_size > MAX_HEADER_BUFFER_SIZE &&
+           body->max_size > MAX_HEADER_BUFFER_SIZE) {
                if (!fetch_header_fields(input, header_section, &hdr_ctx))
                        failed = TRUE;
 
@@ -420,9 +420,10 @@ static int fetch_header(struct imap_fetch_context *ctx, struct mail *mail,
        struct istream *stream;
        struct message_size hdr_size;
 
-       if (ctx->body_fetch_from_cache)
+       if (ctx->body_fetch_from_cache) {
+               memset(&hdr_size, 0, sizeof(hdr_size));
                stream = NULL;
-       else {
+       else {
                stream = mail->get_stream(mail, &hdr_size, NULL);
                if (stream == NULL)
                        return FALSE;