From: Mike Stepanek (mstepane) Date: Tue, 29 Sep 2020 18:39:38 +0000 (+0000) Subject: Merge pull request #2512 in SNORT/snort3 from ~THOPETER/snort3:h2i7 to master X-Git-Tag: 3.0.3-2~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2b733d8c5d4dba5cf65a963cb1096f25826dce99;p=thirdparty%2Fsnort3.git Merge pull request #2512 in SNORT/snort3 from ~THOPETER/snort3:h2i7 to master Squashed commit of the following: commit 20251de1765966cdef9a47dc8ee04787024e0578 Author: Tom Peters Date: Fri Sep 25 16:07:34 2020 -0400 http2_inspect: free up HI flow data when we are finished with it --- diff --git a/src/service_inspectors/http2_inspect/http2_enum.h b/src/service_inspectors/http2_inspect/http2_enum.h index a57c551b4..515bc2b31 100644 --- a/src/service_inspectors/http2_inspect/http2_enum.h +++ b/src/service_inspectors/http2_inspect/http2_enum.h @@ -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, diff --git a/src/service_inspectors/http2_inspect/http2_frame.cc b/src/service_inspectors/http2_inspect/http2_frame.cc index 8da611638..fd1ec4159 100644 --- a/src/service_inspectors/http2_inspect/http2_frame.cc +++ b/src/service_inspectors/http2_inspect/http2_frame.cc @@ -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); } diff --git a/src/service_inspectors/http2_inspect/http2_hpack.cc b/src/service_inspectors/http2_inspect/http2_hpack.cc index ab40feb8a..8ba4edd3d 100644 --- a/src/service_inspectors/http2_inspect/http2_hpack.cc +++ b/src/service_inspectors/http2_inspect/http2_hpack.cc @@ -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; diff --git a/src/service_inspectors/http2_inspect/http2_stream.cc b/src/service_inspectors/http2_inspect/http2_stream.cc index db2b66e29..2f4aa3ee9 100644 --- a/src/service_inspectors/http2_inspect/http2_stream.cc +++ b/src/service_inspectors/http2_inspect/http2_stream.cc @@ -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)