summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-http2.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-17 15:00:52 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-17 15:00:52 +0000
commit0f157e7d6c4be48f213ea022cb2d6d1316c423c8 (patch)
treeff4ad271b50a39e23d5a50a54f4bff37342cdc1c /epan/dissectors/packet-http2.c
parentAdding debian version 4.2.4-1. (diff)
downloadwireshark-0f157e7d6c4be48f213ea022cb2d6d1316c423c8.tar.xz
wireshark-0f157e7d6c4be48f213ea022cb2d6d1316c423c8.zip
Merging upstream version 4.2.5.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'epan/dissectors/packet-http2.c')
-rw-r--r--epan/dissectors/packet-http2.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/epan/dissectors/packet-http2.c b/epan/dissectors/packet-http2.c
index 5def945a..fa51d447 100644
--- a/epan/dissectors/packet-http2.c
+++ b/epan/dissectors/packet-http2.c
@@ -38,6 +38,7 @@
#ifdef HAVE_NGHTTP2
#include <epan/uat.h>
+#include <epan/charsets.h>
#include <epan/decode_as.h>
#include <nghttp2/nghttp2.h>
#include <epan/export_object.h>
@@ -1187,6 +1188,7 @@ http2_cleanup_protocol(void) {
}
static dissector_handle_t http2_handle;
+static dissector_handle_t data_handle;
static reassembly_table http2_body_reassembly_table;
static reassembly_table http2_streaming_reassembly_table;
@@ -3157,6 +3159,21 @@ reassemble_http2_data_according_to_subdissector(tvbuff_t* tvb, packet_info* pinf
streaming_reassembly_info_t* reassembly_info = get_streaming_reassembly_info(pinfo, http2_session);
dissector_handle_t subdissector_handle = dissector_get_string_handle(streaming_content_type_dissector_table, content_type);
+ if (subdissector_handle == NULL) {
+ /* We didn't get the content type, possibly because of byte errors.
+ * Note that the content type is per direction (as it should be)
+ * but reassembly_mode is set the same for *both* directions.
+ *
+ * We could try to set it to the content type used in the other
+ * direction, but among other things, if this is the request,
+ * we might be getting here for the first time on the second pass,
+ * and reassemble_streaming_data_and_call_subdissector() asserts in
+ *
+ * Just set it to data for now to avoid an assert from a NULL handle.
+ */
+ subdissector_handle = data_handle;
+ }
+ /* XXX - Do we still need to set this? */
pinfo->match_string = content_type;
reassemble_streaming_data_and_call_subdissector(
@@ -3238,7 +3255,7 @@ get_real_header_value(packet_info* pinfo, const gchar* name, gboolean the_other_
value_len = pntoh32(data + 4 + name_len);
if (4 + name_len + 4 + value_len == hdr->table.data.datalen) {
/* return value */
- return wmem_strndup(pinfo->pool, data + 4 + name_len + 4, value_len);
+ return get_ascii_string(pinfo->pool, data + 4 + name_len + 4, value_len);
}
else {
return NULL; /* unexpected error */
@@ -4867,6 +4884,8 @@ proto_reg_handoff_http2(void)
media_type_dissector_table = find_dissector_table("media_type");
#endif
+ data_handle = find_dissector("data");
+
dissector_add_uint_range_with_preference("tcp.port", "", http2_handle);
dissector_add_for_decode_as("tcp.port", http2_handle);