Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] Calling a dissector: Type for data parameter

From: Uli Heilmeier <zeugs@xxxxxxxxxxxx>
Date: Sat, 29 May 2021 09:22:06 +0200
Makes sense for me. I will change the MQTT dissector to call call_dissector_with_data() only for sparkplug payload.

Am 29.05.2021 um 09:12 schrieb Anders Broman <a.broman58@xxxxxxxxx>:

Hi,
Shouldn't the caller be calling with the right data type or NULL? So a bug in the MQTT disector?
Regards
Anders


Den lör 29 maj 2021 09:07Uli Heilmeier <zeugs@xxxxxxxxxxxx> skrev:
With MR 2706 [1] the MQTT dissector calls now subdissectors with call_dissector_with_data() [2]. Previously this was call_dissector().

With this change the JSON dissector crashes WS with a memory access segfault (while using MQTT decode topic as option).
This is because for JSON we expect http_message_info_t for data pointer [3]. MQTT hands over a pointer to a char array (topic_str) for data.

How do we handle data type for the data parameter pointer? Would it make sense to compare at least the size of data with the size of http_message_info_t?

I don’t know any way to check the data type of a pointer address location.

Cheers
Uli

[1]: https://gitlab.com/wireshark/wireshark/-/merge_requests/2706/
[2]: https://gitlab.com/wireshark/wireshark/-/merge_requests/2706//diffs#07171e000b3caaabee32ab5dc04a5d28efbaaae3_755_755
[3]: https://gitlab.com/wireshark/wireshark/-/blob/master/epan/dissectors/packet-json.c#L221
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
            mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe