Wrong pointer conversion in get_data_source_tvb_by_name()
Summary
There is a wrong pointer conversion in get_data_source_tvb_by_name()
. data_source
pointer should be retrived from source->data
rather than source itself. See below
// in epan/packet.c
tvbuff_t *
get_data_source_tvb_by_name(packet_info *pinfo, const char *name)
{
GSList *source;
for (source = pinfo->data_src; source; source = source->next) {
struct data_source *this_source = (struct data_source *)source; // should be (struct data_source *)source->data
if (this_source->name && strcmp(this_source->name, name) == 0) {
return this_source->tvb;
}
}
return NULL;
}
Steps to reproduce
I write a dissector plugin and call get_data_source_tvb_by_name(pinfo, "Reassembled TCP");
in dissect function, and find it can't get correct tvb. After I change code like above this fuction return correct tvb.
Build information
- OS: Windows 11
- IDE: Visual Studio 2019
- Wireshark: 4.0.0 (newer version has this issue too)