diff options
Diffstat (limited to 'src/rfc2388.c')
-rw-r--r-- | src/rfc2388.c | 14 |
1 files changed, 13 insertions, 1 deletions
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: |