From 04fa4f414a9d257104bcf6c20372e603865dfb42 Mon Sep 17 00:00:00 2001 From: David Levine Date: Mon, 15 Apr 2013 21:01:12 -0500 Subject: [PATCH] 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. --- sbr/m_getfld.c | 2 ++ test/inc/test-inc-scanout | 15 +++++++++++++++ 2 files changed, 17 insertions(+) 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} -- 2.56.0