smtp: skip preprocessing for mime headers

Mime parser doesn't expect partial lines, which preprocessing can
provide. Add a check to let mime headers be handled by regular line
parsing.
pull/7586/head
Victor Julien 2 years ago
parent 929faae6d4
commit a38f2f2a52

@ -1275,6 +1275,11 @@ static int SMTPPreProcessCommands(
{
DEBUG_VALIDATE_BUG_ON((state->parser_state & SMTP_PARSER_STATE_COMMAND_DATA_MODE) == 0);
/* fall back to strict line parsing for mime header parsing */
if (state->curr_tx && state->curr_tx->mime_state &&
state->curr_tx->mime_state->state_flag < HEADER_DONE)
return 1;
bool line_complete = false;
const int32_t input_len = input->len;
for (int32_t i = 0; i < input_len; i++) {

@ -1706,6 +1706,9 @@ static int FindMimeHeader(const uint8_t *buf, uint32_t blen,
int finish_header = 0, new_header = 0;
MimeDecConfig *mdcfg = MimeDecGetConfig();
/* should not get here with incomplete lines */
DEBUG_VALIDATE_BUG_ON(state->current_line_delimiter_len == 0);
/* Find first header */
hname = FindMimeHeaderStart(buf, blen, &hlen);
if (hname != NULL) {

Loading…
Cancel
Save