From c38d5de46368bc4e28563a4b6759b70436fe3df7 Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Wed, 28 Dec 2022 15:57:12 +0100 Subject: [PATCH] ftp: completely resets port_line 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 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app-layer-ftp.c b/src/app-layer-ftp.c index d0231b46acc5..45e124bd28a4 100644 --- a/src/app-layer-ftp.c +++ b/src/app-layer-ftp.c @@ -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); }