Mime parser doesn't expect partial lines, which preprocessing can
provide. Add a check to let mime headers be handled by regular line
parsing.
(cherry picked from commit
a38f2f2a52822f150fff0d5e17e9f62582d6558c)
static int SMTPPreProcessCommands(SMTPState *state, Flow *f, AppLayerParserState *pstate)
{
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;
+
if (state->ts_db_len) {
/* bail and yield to SMTPGetLine if:
* possible incomplete end of data */
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) {