From: Philippe Antoine Date: Wed, 28 Dec 2022 14:57:12 +0000 (+0100) Subject: ftp: completely resets port_line X-Git-Tag: suricata-6.0.10~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5c0bb7a616a17c7a233093a497d188cc13b5c7f3;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 (cherry picked from commit 1660172a8b5af48b156096c4ad8bebcd9dbfafd9) --- diff --git a/src/app-layer-ftp.c b/src/app-layer-ftp.c index b64a13efb0..caee50ba74 100644 --- a/src/app-layer-ftp.c +++ b/src/app-layer-ftp.c @@ -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); }