]> diplodocus.org Git - nmh/commit
uip/mhparse.c: Fix body starting a byte too soon when no blank line.
authorRalph Corderoy <ralph@inputplus.co.uk>
Fri, 26 May 2017 22:34:10 +0000 (23:34 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Fri, 26 May 2017 22:34:10 +0000 (23:34 +0100)
commitcfb444d37fc236a9fdac369cbcf2a5bfc37a33f5
tree30115f201bd1028431765193eef267ecb155b90e
parent1f07835ddb14fe99fa3ea4b6a1e39e8d5ba7df20
uip/mhparse.c: Fix body starting a byte too soon when no blank line.

m_getfld() returns BODY when the headers run into a line without a colon
instead of being separated from the body by a blank line.  The file's
position and the returned `bufsz' differ from the normal case of a blank
line and then the start of the body, causing confusion.  get_content()
was aware of the difference, documented it, and attempted to correct for
it, but got it wrong and included the `\n' that terminates the last real
header at the start of the "body".  This affected a struct Content's
c_begin.

Use the correct file position for c_begin, adding a comment that
explains the theory for both cases.  Add a test-mhlist case that checks
mhlist(1) states the body size is the same whether it is separated from
the headers by a blank line or not.  Correct existing
test/bad-input/test-header test that expected the extra blank line to be
counted and to appear in the output.
test/bad-input/test-header
test/mhlist/test-mhlist
uip/mhparse.c