]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
ftp: completely resets port_line
authorPhilippe Antoine <pantoine@oisf.net>
Wed, 28 Dec 2022 14:57:12 +0000 (15:57 +0100)
committerVictor Julien <vjulien@oisf.net>
Mon, 23 Jan 2023 09:37:26 +0000 (10:37 +0100)
In the case port_line is first allocated and port_line_len is set,
Then a second request reaches memcap and frees port_line,
port_line_len should also be reset, because both will get used
by the response parsing.

Ticket: #5701
(cherry picked from commit 1660172a8b5af48b156096c4ad8bebcd9dbfafd9)

src/app-layer-ftp.c

index b64a13efb0fa00be80f8079b0ff6ee1fe0d1e1dc..caee50ba74978c84fd5f931c1e42f5ac343f15f8 100644 (file)
@@ -656,6 +656,7 @@ static AppLayerResult FTPParseRequest(Flow *f, void *ftp_state,
                             FTPFree(state->port_line, state->port_line_size);
                             state->port_line = NULL;
                             state->port_line_size = 0;
+                            state->port_line_len = 0;
                         }
                         SCReturnStruct(APP_LAYER_OK);
                     }