From: Philippe Antoine Date: Wed, 28 Dec 2022 14:57:12 +0000 (+0100) Subject: ftp: completely resets port_line X-Git-Tag: suricata-7.0.0-rc1~156 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1660172a8b5af48b156096c4ad8bebcd9dbfafd9;p=thirdparty%2Fsuricata.git 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 --- diff --git a/src/app-layer-ftp.c b/src/app-layer-ftp.c index d0231b46ac..45e124bd28 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); }