dovecot-2.2: lib-mail: istream-attachment-extractor didn't corre...

dovecot at dovecot.org dovecot at dovecot.org
Tue Apr 29 13:16:09 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/c0455a1f650c
changeset: 17292:c0455a1f650c
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Apr 29 16:15:09 2014 +0300
description:
lib-mail: istream-attachment-extractor didn't correctly handle increasing base64 line length.
Based on patch by Pavel Stano

diffstat:

 src/lib-mail/istream-attachment-extractor.c |  12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diffs (29 lines):

diff -r e9f4acfc7ce9 -r c0455a1f650c src/lib-mail/istream-attachment-extractor.c
--- a/src/lib-mail/istream-attachment-extractor.c	Tue Apr 29 16:03:17 2014 +0300
+++ b/src/lib-mail/istream-attachment-extractor.c	Tue Apr 29 16:15:09 2014 +0300
@@ -208,6 +208,12 @@
 		} else if (chr == '=') {
 			part->base64_state = BASE64_STATE_EOM;
 			part->cur_base64_blocks++;
+
+			if (part->cur_base64_blocks > part->base64_line_blocks &&
+			    part->base64_line_blocks > 0) {
+				/* too many blocks */
+				return -1;
+			}
 			return 0;
 		} else {
 			return -1;
@@ -231,6 +237,12 @@
 		part->base64_bytes = part->temp_output->offset + pos + 1;
 		part->base64_state = BASE64_STATE_EOM;
 		part->cur_base64_blocks++;
+
+		if (part->cur_base64_blocks > part->base64_line_blocks &&
+		    part->base64_line_blocks > 0) {
+			/* too many blocks */
+			return -1;
+		}
 		return 0;
 	case BASE64_STATE_EOM:
 		i_unreached();


More information about the dovecot-cvs mailing list