]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
http: handles gaps
authorPhilippe Antoine <contact@catenacyber.fr>
Tue, 19 May 2020 11:57:45 +0000 (13:57 +0200)
committerVictor Julien <victor@inliniac.net>
Mon, 31 Aug 2020 13:16:45 +0000 (15:16 +0200)
ie data=NULL and len>0 from libhtp callbacks

src/app-layer-htp.c

index cc0a12cadba51ee341595bcac7401dbcd134b671..a573c323005451c897af0a7d211edce8e7dd9d63 100644 (file)
@@ -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();