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

Wireshark-dev: [Wireshark-dev] Problem with val_to_str inside BASE_CUSTOM callback function

From: Thomas Wiens <th.wiens@xxxxxx>
Date: Fri, 21 Oct 2016 18:57:49 +0200
Hi,
I'am using fieldtype BASE_CUSTOM and a callback function in my own
dissector.
Works well, but when I am calling val_to_str with a value which is not
inside the value_string list, then wireshark crashes.

This happens only when calling val_to_str inside the callback function.
When outside, then all is Ok (getting formatted result string on failure).
When I'm calling try_val_to_str_idx with a non existing value, then I
get -1 as index and NULL as result as expected, so I guess the problem is:

wmem_strdup_printf(wmem_packet_scope(), fmt, val);

Is there a limitation when I'm using format callbacks, or is this a bug?

-- 
Cheers

Thomas