]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
ftp: don't decrement truncated line len 8982/head
authorShivani Bhardwaj <shivani@oisf.net>
Tue, 6 Jun 2023 10:48:12 +0000 (16:18 +0530)
committerShivani Bhardwaj <shivanib134@gmail.com>
Wed, 7 Jun 2023 03:50:09 +0000 (09:20 +0530)
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.

src/app-layer-ftp.c

index 33b46a906f6bb29ca662136290b36974de312943..fee52a3e61bbc6cbff332162aa9330aa738282d8 100644 (file)
@@ -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;
+                }
             }
         }