]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
tom: static analysis fix for new_http_inspect
authorRuss Combs <rucombs@cisco.com>
Wed, 13 May 2015 11:50:34 +0000 (07:50 -0400)
committerRuss Combs <rucombs@cisco.com>
Wed, 13 May 2015 11:50:34 +0000 (07:50 -0400)
ChangeLog
src/service_inspectors/nhttp_inspect/nhttp_inspect.cc
src/service_inspectors/nhttp_inspect/nhttp_inspect.h
src/service_inspectors/nhttp_inspect/nhttp_stream_splitter.cc

index c5e51c20437a061136ccddc62a8352d1d293f24a..22ce30ec163e407abc99f6f21c8d82f8ed579c08 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Pending - build 152
+
+-- static analysis fix for new_http_inspect
+
 15/05/08 - build 151
 
 -- doc tweaks
index 3c66642cf5199d692f36d0d8098111f4c5237ec1..1e4146847315d471be1d328a927216af7ffe1a24 100644 (file)
@@ -161,6 +161,13 @@ void NHttpInspect::clear(Packet* p)
     if (session_data->transaction[source_id] == nullptr)
         return;
 
+    clear(session_data, source_id);
+}
+
+void NHttpInspect::clear(NHttpFlowData* session_data, SourceId source_id)
+{
+    latest_section = nullptr;
+
     // If current transaction is complete then we are done with it and should reclaim the space
     if ((source_id == SRC_SERVER) && (session_data->type_expected[SRC_SERVER] == SEC_STATUS))
     {
index 3576903fcb5ea8549a964d6479ee6a69bc595342..b1b2958df95e30616d56baeb8f1c0fca27c53857 100644 (file)
@@ -45,6 +45,7 @@ public:
     void show(SnortConfig*) override { LogMessage("NHttpInspect\n"); }
     void eval(Packet*) override { }
     void clear(Packet* p) override;
+    void clear(NHttpFlowData* session_data, NHttpEnums::SourceId source_id);
     void tinit() override { }
     void tterm() override { }
     NHttpStreamSplitter* get_splitter(bool is_client_to_server) override
index 581a4110a2fe21a1202ad2cec41f72de39f97b17..5025aedb73ce75884a266bb69102b11afaf37a88 100644 (file)
@@ -359,8 +359,8 @@ const StreamBuffer* NHttpStreamSplitter::reassemble(Flow* flow, unsigned total,
             if (not_chunk && (session_data->section_type[source_id] != SEC_BODY))
             {
                 delete[] buffer;
-                buffer = nullptr;
             }
+            buffer = nullptr;
             return nullptr;
         }
 
@@ -388,6 +388,7 @@ const StreamBuffer* NHttpStreamSplitter::reassemble(Flow* flow, unsigned total,
             }
             return &nhttp_buf;
         }
+        my_inspector->clear(session_data, source_id);
         buffer = nullptr;
     }
     return nullptr;