From 22275203cc9f97b79ffdedcbe6b51e0086fa8cb6 Mon Sep 17 00:00:00 2001 From: Nathan Angelacos Date: Sun, 15 Feb 2015 23:10:17 +0000 Subject: Version bump to 0.9.34 Fixes for Lua 5.3 compatibility Move sys/fnctl.h to fnctl.h Applied Victor Cook's patch to rfc2388.c regarding crlf positioning in header data --- src/rfc2388.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/rfc2388.c') diff --git a/src/rfc2388.c b/src/rfc2388.c index 971a2e1..621672c 100644 --- a/src/rfc2388.c +++ b/src/rfc2388.c @@ -399,6 +399,8 @@ rfc2388_handler (list_t * env) buffer_t buf; mime_var_t var; + int header_continuation; + /* prevent a potential unitialized free() - ISE-TPS-2014-008 */ var.name = NULL; @@ -449,6 +451,9 @@ rfc2388_handler (list_t * env) state = DISCARD; str = boundary + 2; /* skip the leading crlf */ + + header_continuation = 0; + do { /* x is true if this token ends with a matchstr or is at the end of stream */ @@ -501,6 +506,7 @@ rfc2388_handler (list_t * env) buffer_reset (&buf); mime_var_init (&var); state = HEADER; + header_continuation = 0; str = crlf; } } @@ -510,7 +516,7 @@ rfc2388_handler (list_t * env) buffer_add (&buf, sbuf.segment, sbuf.len); if (x) { - if (sbuf.len == 0) + if (sbuf.len == 0 && header_continuation == 0) { /* blank line */ buffer_reset (&buf); state = CONTENT; @@ -522,7 +528,13 @@ rfc2388_handler (list_t * env) mime_tag_add (&var, (char *) buf.data); buffer_reset (&buf); } + header_continuation = 0; } + else + { + // expect more data + header_continuation = 1; + } break; case CONTENT: -- cgit v1.2.3