From: Philippe Antoine Date: Tue, 19 May 2020 11:57:45 +0000 (+0200) Subject: http: handles gaps X-Git-Tag: suricata-6.0.0-rc1~95 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d509a7807430c29cf57905239586920aeaa85c5c;p=thirdparty%2Fsuricata.git http: handles gaps ie data=NULL and len>0 from libhtp callbacks --- diff --git a/src/app-layer-htp.c b/src/app-layer-htp.c index cc0a12cadb..a573c32300 100644 --- a/src/app-layer-htp.c +++ b/src/app-layer-htp.c @@ -1777,7 +1777,7 @@ static int HTPCallbackRequestBodyData(htp_tx_data_t *d) if (!(SC_ATOMIC_GET(htp_config_flags) & HTP_REQUIRE_REQUEST_BODY)) SCReturnInt(HTP_OK); - if (d->data == NULL || d->len == 0) + if (d->len == 0) SCReturnInt(HTP_OK); #ifdef PRINT @@ -1909,7 +1909,7 @@ static int HTPCallbackResponseBodyData(htp_tx_data_t *d) if (!(SC_ATOMIC_GET(htp_config_flags) & HTP_REQUIRE_RESPONSE_BODY)) SCReturnInt(HTP_OK); - if (d->data == NULL || d->len == 0) + if (d->len == 0) SCReturnInt(HTP_OK); HtpState *hstate = htp_connp_get_user_data(d->tx->connp); @@ -3093,6 +3093,9 @@ void RegisterHTPParsers(void) AppLayerParserRegisterParser(IPPROTO_TCP, ALPROTO_HTTP, STREAM_TOCLIENT, HTPHandleResponseData); SC_ATOMIC_INIT(htp_config_flags); + /* This parser accepts gaps. */ + AppLayerParserRegisterOptionFlags( + IPPROTO_TCP, ALPROTO_HTTP, APP_LAYER_PARSER_OPT_ACCEPT_GAPS); AppLayerParserRegisterParserAcceptableDataDirection(IPPROTO_TCP, ALPROTO_HTTP, STREAM_TOSERVER|STREAM_TOCLIENT); HTPConfigure();