ACDR: don't call the JSON dissector as an ACDR media type dissector.

We pass an acdr_dissector_data_t * to dissectors for the
"acdr.media_type" dissector table, but the JSON dissector expects an
http_message_info_t *.

Hilarity ensues.

Instead, have our own dissector for VoiceAI, that calls the JSON
dissector and passes it *no* data.

Bug: 16622
Change-Id: Icb5b216ed63ab02680372836885b27de9541684c
Reviewed-on: https://code.wireshark.org/review/37484
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
This commit is contained in:
Guy Harris 2020-06-15 14:26:36 -07:00
parent 526a9a64ee
commit 933067acc2
1 changed files with 17 additions and 1 deletions

View File

@ -1195,6 +1195,22 @@ dissect_acdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
return tvb_captured_length(tvb);
}
static int
dissect_acdr_voiceai(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
/*
* I guess this is just a blob of JSON.
*
* Do *NOT* pass data to the JSON dissector; it's expecting
* an http_message_info_t *, and that's *NOT* what we hand
* subdissectors. Hilarity ensures; see
*
* https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=16622
*/
call_dissector(json_dissector_handle, tvb, pinfo, tree);
return tvb_captured_length(tvb);
}
static int
dissect_acdr_tls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
@ -1986,7 +2002,7 @@ proto_reg_handoff_acdr(void)
dissector_add_uint_with_preference("tcp.port", PORT_AC_DR, acdr_dissector_handle);
// Register "local" media types
dissector_add_uint("acdr.media_type", ACDR_VoiceAI, json_dissector_handle);
dissector_add_uint("acdr.media_type", ACDR_VoiceAI, create_dissector_handle(dissect_acdr_voiceai, -1));
dissector_add_uint("acdr.media_type", ACDR_TLS, create_dissector_handle(dissect_acdr_tls, -1));
dissector_add_uint("acdr.media_type", ACDR_TLSPeek, create_dissector_handle(dissect_acdr_tls, -1));
dissector_add_uint("acdr.media_type", ACDR_SIP, create_dissector_handle(dissect_acdr_sip, -1));