]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
http: wait for response line for filename
authorPhilippe Antoine <contact@catenacyber.fr>
Tue, 2 Apr 2019 14:32:43 +0000 (16:32 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 3 Sep 2019 08:06:10 +0000 (10:06 +0200)
See http evader case 481

src/app-layer-htp.c

index 587e4162d0cebab188279c026571516990fc2adb..7cdd727c510e37f187672ea3d8c6af0854362ee5 100644 (file)
@@ -1638,8 +1638,12 @@ static int HtpResponseBodyHandle(HtpState *hstate, HtpTxUserData *htud,
 
     int result = 0;
 
-    /* see if we need to open the file */
-    if (!(htud->tcflags & HTP_FILENAME_SET))
+    /* see if we need to open the file
+     * we check for tx->response_line in case of junk
+     * interpreted as body before response line
+     */
+    if (!(htud->tcflags & HTP_FILENAME_SET) &&
+        (tx->response_line != NULL || tx->is_protocol_0_9))
     {
         SCLogDebug("setting up file name");
 
@@ -1684,7 +1688,7 @@ static int HtpResponseBodyHandle(HtpState *hstate, HtpTxUserData *htud,
             }
         }
     }
-    else
+    else if (tx->response_line != NULL || tx->is_protocol_0_9)
     {
         /* otherwise, just store the data */