diff options
| author | Sam Varshavchik | 2015-07-19 06:36:20 -0400 | 
|---|---|---|
| committer | Sam Varshavchik | 2015-07-19 06:36:20 -0400 | 
| commit | 796dc9a0b94b67f1303e1db61311f7b458e5e36a (patch) | |
| tree | 517c8fc556745197d70a818e71512e45e90095dd | |
| parent | 19309085193effe5d231fa3c99e8f9c33fdc2b4f (diff) | |
| download | courier-libs-796dc9a0b94b67f1303e1db61311f7b458e5e36a.tar.bz2 | |
Fix parsing of a message without a body.
Until the empty line separating headers from body is read, point
startofbody at the end of the parsed text, so if the empty line
is never read, the entire contents of the message is parsed as
headers.
| -rw-r--r-- | maildrop/testsuite2 | 20 | ||||
| -rw-r--r-- | rfc2045/rfc2045.c | 6 | 
2 files changed, 26 insertions, 0 deletions
| diff --git a/maildrop/testsuite2 b/maildrop/testsuite2 index e63768b..8d08e1b 100644 --- a/maildrop/testsuite2 +++ b/maildrop/testsuite2 @@ -240,4 +240,24 @@ do  done  runtest " with xfilter" + +cat >testsuite.msg <<EOF +X-Spam-Flag: yes +EOF +cat >testsuite1.filter <<EOF +EXITCODE=0 +if (/^X-Spam-Flag/) +{ +    EXITCODE=1 +} +EOF + +chmod 600 testsuite1.filter + +if ./maildrop ./testsuite1.filter <testsuite.msg +then +    echo "bodyless message test failed" +    exit 1 +fi +  rm -f testsuite?.filter testsuite.msg diff --git a/rfc2045/rfc2045.c b/rfc2045/rfc2045.c index 8cbd3a7..40c2017 100644 --- a/rfc2045/rfc2045.c +++ b/rfc2045/rfc2045.c @@ -652,6 +652,12 @@ int	bit8=0;  	update_counts(p, p->endpos + cnt, p->endpos+n, 1); +	/* +	** Until we see an official start of message body, the body starts +	** right after what we just read. +	*/ +	p->startbody=p->endbody; +  	/* If this header line starts with a space, append one space  	** to the saved contents of the previous line, and append this  	** line to it. | 
