]> 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>
Tue, 17 Jan 2023 13:25:06 +0000 (14:25 +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

src/app-layer-ftp.c

index d0231b46acc522fbf1392fc891a14417ec7c8184..45e124bd28a401a214ee25cfc7cbe8bb92f54c0e 100644 (file)
@@ -645,6 +645,7 @@ static AppLayerResult FTPParseRequest(Flow *f, void *ftp_state, AppLayerParserSt
                             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);
                     }