From: David Levine Date: Fri, 21 Oct 2016 17:22:22 +0000 (-0400) Subject: Have m_getfld() pass back indication of missing blank line. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/47313b9bc395470311e383b57eb184c830662c4a Have m_getfld() pass back indication of missing blank line. This is part one of a two part fix to the MIME parser to read binary content. It should have no effect. Also added start/finish test calls to test-header. --- diff --git a/sbr/m_getfld.c b/sbr/m_getfld.c index 1a1411eb..6d5f04f0 100644 --- a/sbr/m_getfld.c +++ b/sbr/m_getfld.c @@ -581,6 +581,9 @@ m_getfld (m_getfld_state_t *gstate, char name[NAMESZ], char *buf, int *bufsz, memcpy (buf, name, n - 1); buf[n - 1] = '\n'; buf[n] = '\0'; + /* Indicate this wasn't a header field using a character + that can't appear in a header field. */ + name[0] = ':'; /* The last character read was '\n'. s->bytes_read (and n) include that, but it was not put into the name array in the for loop above. So subtract 1. */ diff --git a/test/bad-input/test-header b/test/bad-input/test-header index eeacc831..ef7b3992 100755 --- a/test/bad-input/test-header +++ b/test/bad-input/test-header @@ -34,6 +34,7 @@ I am a stupid spammer. EOF # check scan +start_test scan cat >"$expected" < "$actual" 2>&1 check "$expected" "$actual" : scan with bogus header field # check show (mhl) +start_test show cat >"$expected" < "$actual" 2>&1 check "$expected" "$actual" : "show (mhl) with bogus header field" # check mhshow +start_test mhshow cat >"$expected" < "$actual" 2>&1 check "$expected" "$actual" : mhshow with bogus header field # check m_getfld() handling of empty header field +start_test 'm_getfld() handling of empty header field' msgfile="$MH_TEST_DIR/Mail/inbox/12" printf 'Date: Sat, 12 Jan 2013 09:07:01 -0600\nReceived:' >"$msgfile" cat >"$expected" <"$msgfile" <"$msgfile" <