]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #2512 in SNORT/snort3 from ~THOPETER/snort3:h2i7 to master
authorMike Stepanek (mstepane) <mstepane@cisco.com>
Tue, 29 Sep 2020 18:39:38 +0000 (18:39 +0000)
committerMike Stepanek (mstepane) <mstepane@cisco.com>
Tue, 29 Sep 2020 18:39:38 +0000 (18:39 +0000)
Squashed commit of the following:

commit 20251de1765966cdef9a47dc8ee04787024e0578
Author: Tom Peters <thopeter@cisco.com>
Date:   Fri Sep 25 16:07:34 2020 -0400

    http2_inspect: free up HI flow data when we are finished with it

src/service_inspectors/http2_inspect/http2_enum.h
src/service_inspectors/http2_inspect/http2_frame.cc
src/service_inspectors/http2_inspect/http2_hpack.cc
src/service_inspectors/http2_inspect/http2_stream.cc

index a57c551b47a89a1531998ab44dff98d2bbf420ae..515bc2b31d47e2a02d47977a838247f892bda8c9 100644 (file)
@@ -92,7 +92,7 @@ enum Infraction
     INF_HUFFMAN_INCOMPLETE_CODE_PADDING = 9,
     INF_MISSING_CONTINUATION = 10,
     INF_UNEXPECTED_CONTINUATION = 11,
-    INF_LOOKUP_EMPTY_VALUE = 12,
+    INF_UNUSED_1 = 12,
     INF_INVALID_PSEUDO_HEADER = 13,
     INF_PSEUDO_HEADER_AFTER_REGULAR_HEADER = 14,
     INF_PSEUDO_HEADER_URI_FORM_MISMATCH = 15,
index 8da6116380fa1a02311fed2dd14756bd62b8cda6..fd1ec4159e3ad2be9c680ffb15a9dd30f0a77be3 100644 (file)
@@ -43,7 +43,7 @@ Http2Frame::Http2Frame(const uint8_t* header_buffer, const uint32_t header_len,
 {
     header.set(header_len, header_buffer, true);
     // FIXIT-E want to refactor so that zero-length frames are not a special case
-    if (data_len > 0)
+    if (data_buffer != nullptr)
         data.set(data_len, data_buffer, true);
 }
 
index ab40feb8a40dc3079599c50598a0cef247d26ce7..8ba4edd3dab18ef186920f5dbbfe8bd355ccf606 100644 (file)
@@ -198,12 +198,6 @@ bool Http2HpackDecoder::decode_indexed_header(const uint8_t* encoded_header_buff
     name.set(entry->name);
     value.set(entry->value);
 
-    // FIXIT-E how bad is this?
-    if (value.length() <= 0)
-    {
-        *infractions += INF_LOOKUP_EMPTY_VALUE;
-    }
-
     if (!write_header_part(name, (const uint8_t*)": ", 2, decoded_header_buffer,
         decoded_header_length, partial_bytes_written))
         return false;
index db2b66e2904a22eddc5f4bb4c3eb4138fbe0db32..2f4aa3ee9cb626d9f4c37faaaa6d844fa29af968 100644 (file)
@@ -77,6 +77,14 @@ void Http2Stream::clear_frame()
     current_frame->clear();
     delete current_frame;
     current_frame = nullptr;
+
+    if ((state[SRC_CLIENT] >= STREAM_COMPLETE) && (state[SRC_SERVER] >= STREAM_COMPLETE) &&
+        (hi_flow_data != nullptr))
+    {
+        delete hi_flow_data;
+        hi_flow_data = nullptr;
+        session_data->deallocate_hi_memory();
+    }
 }
 
 void Http2Stream::set_state(HttpCommon::SourceId source_id, StreamState new_state)