]> diplodocus.org Git - nmh/commitdiff
Fixed problem in m_getfld() reported by Paul Fox. When
authorDavid Levine <levinedl@acm.org>
Tue, 16 Apr 2013 02:01:12 +0000 (21:01 -0500)
committerDavid Levine <levinedl@acm.org>
Tue, 16 Apr 2013 02:01:12 +0000 (21:01 -0500)
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
test/inc/test-inc-scanout

index 45bcebabda08e16d2ded8eb582d821957bd2b527..07f4c0a518abce5117f199bc0b6e836ab03b1155 100644 (file)
@@ -799,6 +799,7 @@ m_unknown(m_getfld_state_t *gstate, FILE *iob)
     } else {
        /* not a Unix style maildrop */
        s->readpos -= s->bytes_read;
     } else {
        /* not a Unix style maildrop */
        s->readpos -= s->bytes_read;
+       s->bytes_read = 0;
        delimstr = mmdlm2;
        s->msg_style = MS_MMDF;
     }
        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;
           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;
     }
 
        return 0;
     }
 
index ffe2c46da8f26e81e29980d12140a4b523ba5727..9b4e0ba4fd9410b995bdcbbe7a3a1c8f7e66348e 100755 (executable)
@@ -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"
 
   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" <<EOF
+From 
+From: me@example.com
+
+
+test
+EOF
+
+run_test "inc -width 80 -file $MH_TEST_DIR/msgbox -truncate" \
+'Incorporating new mail into inbox...
+
+  25+ 04/15*me@example.com     <<test >>'
+rm -f  "$MH_TEST_DIR/msgbox"
+
 
 exit ${failed:-0}
 
 exit ${failed:-0}