]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Squashed commit of the following:
authorRuss Combs <rucombs@cisco.com>
Wed, 1 Jul 2015 17:40:00 +0000 (13:40 -0400)
committerRuss Combs <rucombs@cisco.com>
Wed, 1 Jul 2015 17:40:00 +0000 (13:40 -0400)
commit 2013351aa4e456f3bd910dcf08ba7289b6fa9b45
Author: Tom Peters <thopeter@cisco.com>
Date:   Tue Jun 30 14:57:43 2015 -0400

    File processing complete

commit be3c57506fe6e654da94e962150a7114ac99ec56
Author: Tom Peters <thopeter@cisco.com>
Date:   Fri Jun 26 13:55:35 2015 -0400

    File processing stage 2 - MIME but not unexpected close processing

src/service_inspectors/nhttp_inspect/nhttp_flow_data.cc
src/service_inspectors/nhttp_inspect/nhttp_flow_data.h
src/service_inspectors/nhttp_inspect/nhttp_msg_body.cc
src/service_inspectors/nhttp_inspect/nhttp_msg_chunk.cc
src/service_inspectors/nhttp_inspect/nhttp_msg_header.cc
src/service_inspectors/nhttp_inspect/nhttp_msg_header.h
src/service_inspectors/nhttp_inspect/nhttp_stream_splitter.cc
src/service_inspectors/nhttp_inspect/nhttp_test_msgs.txt
src/utils/util.h

index 6894886b0b8ff1a3b08b02c96df97e974aae9a3b..198831bb24845027f76e581e1340b28f93c7cc30 100644 (file)
@@ -52,6 +52,12 @@ NHttpFlowData::~NHttpFlowData()
         delete transaction[k];
         delete cutter[k];
     }
+
+    if (mime_state != nullptr)
+    {
+        free_mime_session(mime_state);
+    }
+
     delete_pipeline();
 }
 
@@ -60,21 +66,27 @@ void NHttpFlowData::half_reset(SourceId source_id)
     assert((source_id == SRC_CLIENT) || (source_id == SRC_SERVER));
 
     version_id[source_id] = VERS__NOTPRESENT;
+    data_length[source_id] = STAT_NOTPRESENT;
+    body_octets[source_id] = STAT_NOTPRESENT;
+    section_size_target[source_id] = 0;
+    section_size_max[source_id] = 0;
+    file_depth_remaining[source_id] = STAT_NOTPRESENT;
+    infractions[source_id].reset();
+    events[source_id].reset();
+
     if (source_id == SRC_CLIENT)
     {
         method_id = METH__NOTPRESENT;
+        if (mime_state != nullptr)
+        {
+            free_mime_session(mime_state);
+            mime_state = nullptr;
+        }
     }
     else
     {
         status_code_num = STAT_NOTPRESENT;
     }
-    data_length[source_id] = STAT_NOTPRESENT;
-    body_octets[source_id] = STAT_NOTPRESENT;
-    section_size_target[source_id] = 0;
-    section_size_max[source_id] = 0;
-    file_depth_remaining[source_id] = STAT_NOTPRESENT;
-    infractions[source_id].reset();
-    events[source_id].reset();
 }
 
 void NHttpFlowData::show(FILE* out_file) const
index e220afbaf30f74759638483ccb7e22173b21cb09..fcc86a81ac477d230835d9a47f20f0363684df78 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <stdio.h>
 #include "stream/stream_api.h"
+#include "file_api/file_mime_process.h"
 
 #include "nhttp_cutter.h"
 #include "nhttp_infractions.h"
@@ -95,6 +96,7 @@ private:
     NHttpEnums::MethodId method_id = NHttpEnums::METH__NOTPRESENT;
     int32_t status_code_num = NHttpEnums::STAT_NOTPRESENT;
     int64_t file_depth_remaining[2] = { NHttpEnums::STAT_NOTPRESENT, NHttpEnums::STAT_NOTPRESENT };
+    MimeState* mime_state = nullptr;  // SRC_CLIENT only
 
     // number of user data octets seen so far (regular body or chunks)
     int64_t body_octets[2] = { NHttpEnums::STAT_NOTPRESENT, NHttpEnums::STAT_NOTPRESENT };
index 2297f602be761120c520b647b6b8ec97aa0caeea..2eae4015da85b8ab92443c83c1bebdeabd5961a0 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "detection/detection_util.h"
 #include "file_api/file_api.h"
+#include "file_api/file_mime_process.h"
 
 #include "nhttp_enum.h"
 #include "nhttp_msg_request.h"
@@ -44,7 +45,16 @@ void NHttpMsgBody::analyze()
     data.start = msg_text.start;
     data.length = msg_text.length;
 
-    do_file_processing();
+    // Always set file data. File processing will later set a new value in some cases.
+    if (data.length > 0)
+    {
+        set_file_data(const_cast<uint8_t*>(data.start), (unsigned)data.length);
+    }
+
+    if (session_data->file_depth_remaining[source_id] > 0)
+    {
+        do_file_processing();
+    }
 
     body_octets += msg_text.length;
 
@@ -54,25 +64,28 @@ void NHttpMsgBody::analyze()
 
 void NHttpMsgBody::do_file_processing()
 {
-    // Always set file data. File processing will later set a new value in some cases.
-    set_file_data((uint8_t*)data.start, (unsigned)data.length);
-
-    if (session_data->file_depth_remaining[source_id] > 0)
+    // Using the trick that cutter is deleted when regular or chunked body is complete
+    const bool front = (body_octets == 0);
+    const bool back = (session_data->cutter[source_id] == nullptr) || tcp_close;
+    FilePosition file_position;
+    if (front && back) file_position = SNORT_FILE_FULL;
+    else if (front) file_position = SNORT_FILE_START;
+    else if (back) file_position = SNORT_FILE_END;
+    else file_position = SNORT_FILE_MIDDLE;
+
+    // Chunked body with nothing but the zero length chunk?
+    if (front && (data.length == 0))
     {
-        // Using the trick that cutter is deleted when regular or chunked body is complete
-        const bool front = (body_octets == 0);
-        const bool back = (session_data->cutter[source_id] == nullptr) || tcp_close;
-        FilePosition file_position;
-        if (front && back) file_position = SNORT_FILE_FULL;
-        else if (front) file_position = SNORT_FILE_START;
-        else if (back) file_position = SNORT_FILE_END;
-        else file_position = SNORT_FILE_MIDDLE;
-
-        int32_t fp_length = (data.length <= session_data->file_depth_remaining[source_id]) ?
-            data.length : session_data->file_depth_remaining[source_id];
+        return;
+    }
+
+    const int32_t fp_length = (data.length <= session_data->file_depth_remaining[source_id]) ?
+        data.length : session_data->file_depth_remaining[source_id];
 
+    if (source_id == SRC_SERVER)
+    {
         if (file_api->file_process(flow, const_cast<uint8_t*>(data.start), fp_length,
-            file_position, source_id == SRC_CLIENT, false))
+            file_position, false, false))
         {
             session_data->file_depth_remaining[source_id] -= fp_length;
 
@@ -97,6 +110,18 @@ void NHttpMsgBody::do_file_processing()
             session_data->file_depth_remaining[source_id] = 0;
         }
     }
+    else
+    {
+        file_api->process_mime_data(flow, data.start, data.start + fp_length,
+            session_data->mime_state, true, file_position);
+
+        session_data->file_depth_remaining[source_id] -= fp_length;
+        if (session_data->file_depth_remaining[source_id] == 0)
+        {
+            free_mime_session(session_data->mime_state);
+            session_data->mime_state = nullptr;
+        }
+    }
 }
 
 void NHttpMsgBody::gen_events()
index b872d24c3b7be2c372d66609c7e7c86ea3d1553a..83b65e8d4aa2bbc9a0272cbdd173b0398cebfcd6 100644 (file)
@@ -21,6 +21,8 @@
 #include <sys/types.h>
 #include <stdio.h>
 
+#include "file_api/file_mime_process.h"
+
 #include "nhttp_enum.h"
 #include "nhttp_msg_chunk.h"
 
@@ -52,6 +54,12 @@ void NHttpMsgChunk::update_flow()
         session_data->type_expected[source_id] = SEC_TRAILER;
         session_data->infractions[source_id].reset();
         session_data->events[source_id].reset();
+
+        if ((source_id == SRC_CLIENT) && (session_data->mime_state != nullptr))
+        {
+            free_mime_session(session_data->mime_state);
+            session_data->mime_state = nullptr;
+        }
     }
     else
     {
index 9d1a5b435f3ae912b400ad05c069896111db0e35..d5d4721672fd2a7c6854d23dc8a020ace939dcc9 100644 (file)
@@ -21,8 +21,8 @@
 #include <sys/types.h>
 #include <stdio.h>
 
+#include "utils/util.h"
 #include "detection/detection_util.h"
-#include "file_api/file_api.h"
 
 #include "nhttp_enum.h"
 #include "nhttp_msg_request.h"
@@ -104,6 +104,18 @@ void NHttpMsgHeader::update_flow()
         if (session_data->file_depth_remaining[1-source_id] <= 0)
         {   // Bidirectional file processing is problematic FIXIT-M
             session_data->file_depth_remaining[source_id] = file_api->get_max_file_depth();
+            if (source_id == SRC_CLIENT)
+            {
+                // FIXIT-L Cannot use new because file_api insists on freeing the mime_state using
+                // free().
+                session_data->mime_state = (MimeState*) new_calloc(1, sizeof(MimeState));
+                file_api->set_mime_log_config_defauts(&mime_conf);
+                session_data->mime_state->log_config = &mime_conf;
+                file_api->set_mime_decode_config_defauts(&decode_conf);
+                session_data->mime_state->decode_conf = &decode_conf;
+                file_api->set_log_buffers(&session_data->mime_state->log_state,
+                    session_data->mime_state->log_config);
+            }
         }
         session_data->infractions[source_id].reset();
         session_data->events[source_id].reset();
index 807e190828b9b0d8d846b8ed602463c02e3a348d..0fe04b181f8edb8d10e0cea96f60416594b676f5 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef NHTTP_MSG_HEADER_H
 #define NHTTP_MSG_HEADER_H
 
+#include "file_api/file_api.h"
+
 #include "nhttp_msg_head_shared.h"
 
 //-------------------------------------------------------------------------
@@ -34,6 +36,10 @@ public:
     void print_section(FILE* output) override;
     void gen_events() override;
     void update_flow() override;
+private:
+    // Dummy configurations to support MIME processing
+    MAIL_LogConfig mime_conf;
+    DecodeConfig decode_conf;
 };
 
 #endif
index 95f4a09eb8949f2e5c1eb32b0195826644c4b535..1af30bcf4acc5d9911d2b9063b704243b25c9cc1 100644 (file)
@@ -432,11 +432,12 @@ bool NHttpStreamSplitter::finish(Flow* flow)
     }
 
     session_data->tcp_close[source_id] = true;
+
     // If there is leftover data for which we returned PAF_SEARCH and never flushed, we need to set
     // up to process because it is about to go to reassemble(). But we don't support partial start
     // lines.
     if ((session_data->section_type[source_id] == SEC__NOTCOMPUTE) &&
-        (session_data->cutter[source_id] != nullptr) &&
+        (session_data->cutter[source_id] != nullptr)               &&
         (session_data->cutter[source_id]->get_octets_seen() > 0))
     {
         if ((session_data->type_expected[source_id] == SEC_REQUEST) ||
@@ -453,7 +454,29 @@ bool NHttpStreamSplitter::finish(Flow* flow)
             session_data->cutter[source_id]->get_num_head_lines() + 1,
             session_data->cutter[source_id]->get_is_broken_chunk(),
             session_data->cutter[source_id]->get_num_good_chunks());
+        return true;
+    }
+
+    // If there is no more data to process we need to wrap up file processing right now
+    if ((session_data->section_type[source_id] == SEC__NOTCOMPUTE) &&
+        (session_data->file_depth_remaining[source_id] > 0)        &&
+        (session_data->cutter[source_id] != nullptr)               &&
+        (session_data->cutter[source_id]->get_octets_seen() == 0))
+    {
+        if (source_id == SRC_SERVER)
+        {
+            file_api->file_process(flow, nullptr, 0, SNORT_FILE_END, false, false);
+        }
+        else
+        {
+            file_api->process_mime_data(flow, nullptr, 0, session_data->mime_state, true,
+                SNORT_FILE_END);
+            free_mime_session(session_data->mime_state);
+            session_data->mime_state = nullptr;
+        }
+        return false;
     }
+
     return true;
 }
 
index 7ad93375d91995b87d2af3b6959ec1f8beb71b80..5686242dbd2522e78e2158bed3c7539a6b5d1d38 100644 (file)
@@ -861,6 +861,221 @@ Accept-Language: en,  de\r\n
 Accept-Language: is\r\n
 \r\n
 
+@9003
+@break
+@response
+HTTP/1.1 200 Example with exactly 16384 octets\r\nTransfer-Encoding: chunked\r\n\r\n
+
+400\r\n
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+123456789012345678901234\r\n
+
+400\r\n
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+123456789012345678901234\r\n
+
+400\r\n
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+123456789012345678901234\r\n
+
+400\r\n
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+123456789012345678901234\r\n
+
+400\r\n
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+123456789012345678901234\r\n
+
+400\r\n
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+123456789012345678901234\r\n
+
+400\r\n
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+123456789012345678901234\r\n
+
+400\r\n
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+123456789012345678901234\r\n
+
+400\r\n
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+123456789012345678901234\r\n
+
+400\r\n
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+123456789012345678901234\r\n
+
+400\r\n
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+123456789012345678901234\r\n
+
+400\r\n
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+123456789012345678901234\r\n
+
+400\r\n
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+123456789012345678901234\r\n
+
+400\r\n
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+123456789012345678901234\r\n
+
+400\r\n
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+123456789012345678901234\r\n
+
+400\r\n
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+123456789012345678901234\r\n
+
+0\r\n\r\n
+
 # ***********************************************************************************************
 # Invalid chunks
 # @10001
index 19920da61f58b115aa6a77bdd08dd1d03f1bdb87..066672ad281e8c209db128de27c5e68e22f5030c 100644 (file)
@@ -137,6 +137,16 @@ static inline void* SnortAlloc(unsigned long size)
     return NULL;
 }
 
+static inline void* new_calloc(size_t num, size_t size)
+{
+    void* ret_val = calloc(num, size);
+    if (ret_val == nullptr)
+    {
+        throw std::bad_alloc();
+    }
+    return ret_val;
+}
+
 static inline long SnortStrtol(const char* nptr, char** endptr, int base)
 {
     long iRet;