uint32_t o_consumed = state->consumed;
state->consumed = lf_idx - state->input + 1;
state->current_line_len = state->consumed - o_consumed;
+ state->current_line_lf_found = true;
DEBUG_VALIDATE_BUG_ON(state->current_line_len < 0);
if (state->current_line_len < 0)
SCReturnStruct(APP_LAYER_ERROR);
state->consumed = 0;
state->current_line_len = 0;
state->current_line_delimiter_len = 0;
+ state->current_line_lf_found = false;
state->direction = direction;
+
+ /* toserver */
if (direction == 0) {
if (((state->current_command == SMTP_COMMAND_DATA) ||
(state->current_command == SMTP_COMMAND_BDAT)) &&
SCReturnStruct(APP_LAYER_ERROR);
if (state->current_line_delimiter_len == 0 &&
state->current_line_len == SMTP_LINE_BUFFER_LIMIT) {
- state->discard_till_lf = true;
+ if (!state->current_line_lf_found) {
+ state->discard_till_lf = true;
+ }
state->consumed = state->input_len + 1; // For the newly found LF
SMTPSetEvent(state, SMTP_DECODER_EVENT_TRUNCATED_LINE);
break;
SCReturnStruct(APP_LAYER_ERROR);
if (state->current_line_delimiter_len == 0 &&
state->current_line_len == SMTP_LINE_BUFFER_LIMIT) {
- state->discard_till_lf = true;
+ if (!state->current_line_lf_found) {
+ state->discard_till_lf = true;
+ }
state->consumed = state->input_len + 1; // For the newly found LF
SMTPSetEvent(state, SMTP_DECODER_EVENT_TRUNCATED_LINE);
break;
/** length of the line in current_line. Doesn't include the delimiter */
int32_t current_line_len;
uint8_t current_line_delimiter_len;
+ bool current_line_lf_found;
/* Consumed bytes till current line */
int32_t consumed;
/* If rest of the bytes should be discarded in case of long line w/o LF */