From: David Levine Date: Tue, 16 Apr 2013 02:01:12 +0000 (-0500) Subject: Fixed problem in m_getfld() reported by Paul Fox. When X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/04fa4f414a9d257104bcf6c20372e603865dfb42?hp=55f65ae2d3baf60396d3359db952460939de03ca Fixed problem in m_getfld() reported by Paul Fox. When inc'ing a message from a maildrop with two blank lines between the header and body, the last 3 or 4 characters of the last header would be copied into the body. --- diff --git a/sbr/m_getfld.c b/sbr/m_getfld.c index 45bcebab..07f4c0a5 100644 --- a/sbr/m_getfld.c +++ b/sbr/m_getfld.c @@ -799,6 +799,7 @@ m_unknown(m_getfld_state_t *gstate, FILE *iob) } else { /* not a Unix style maildrop */ s->readpos -= s->bytes_read; + s->bytes_read = 0; delimstr = mmdlm2; s->msg_style = MS_MMDF; } @@ -883,6 +884,7 @@ m_Eom (m_getfld_state_t s, int c) Note that on input, a character had already been read with Getc(). It will be unget by m_getfld () on return. */ s->readpos -= s->bytes_read - 1; + s->bytes_read = 1; return 0; } diff --git a/test/inc/test-inc-scanout b/test/inc/test-inc-scanout index ffe2c46d..9b4e0ba4 100755 --- a/test/inc/test-inc-scanout +++ b/test/inc/test-inc-scanout @@ -329,5 +329,20 @@ run_test "inc -width 80 -file $MH_TEST_DIR/msgbox -truncate" \ 24 12/18 foo@example.edu test' rm -f "$MH_TEST_DIR/msgbox" +# check mbox with two blank lines between header and body +cat >>"$MH_TEST_DIR/msgbox" <>' +rm -f "$MH_TEST_DIR/msgbox" + exit ${failed:-0}