From: Shivani Bhardwaj Date: Tue, 6 Jun 2023 10:48:12 +0000 (+0530) Subject: ftp: don't decrement truncated line len X-Git-Tag: suricata-6.0.13~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F8982%2Fhead;p=thirdparty%2Fsuricata.git ftp: don't decrement truncated line len In case LF was found for a long line way outside of the limit, we should not need to update the delimiter len and current line len because the line is capped at 4k and the LF was not within these 4k bytes. --- diff --git a/src/app-layer-ftp.c b/src/app-layer-ftp.c index 33b46a906f..fee52a3e61 100644 --- a/src/app-layer-ftp.c +++ b/src/app-layer-ftp.c @@ -471,12 +471,13 @@ static int FTPGetLineForDirection( state->current_line_len = lf_idx - state->input; } - if (state->input != lf_idx && - *(lf_idx - 1) == 0x0D) { - state->current_line_len--; - state->current_line_delimiter_len = 2; - } else { - state->current_line_delimiter_len = 1; + if (!*current_line_truncated) { + if (state->input != lf_idx && *(lf_idx - 1) == 0x0D) { + state->current_line_len--; + state->current_line_delimiter_len = 2; + } else { + state->current_line_delimiter_len = 1; + } } }