[dovecot-cvs] dovecot/src/imap imap-fetch-body-section.c,1.25,1.26

cras at procontrol.fi cras at procontrol.fi
Mon May 3 16:53:37 EEST 2004


Update of /home/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv15449

Modified Files:
	imap-fetch-body-section.c 
Log Message:
don't access uninitialized memory



Index: imap-fetch-body-section.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap/imap-fetch-body-section.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- imap-fetch-body-section.c	2 May 2004 13:05:53 -0000	1.25
+++ imap-fetch-body-section.c	3 May 2004 13:53:35 -0000	1.26
@@ -366,9 +366,9 @@
 	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 @@
 	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;



More information about the dovecot-cvs mailing list