ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: [Wireshark-dev] tvbuff_t->ds_tvb for TVBUFF_REAL_DATA may end up unset

From: Jan Christoph Nordholz <hesso@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 26 Aug 2008 03:52:24 +0200
Hi,

while developping a small exemplary dissector, I was puzzled that
tvb_new() and tvb_set_real_data() do not set the new tvbuff's ds_tvb
member, whereas tvb_new_real_data() does. I don't know whether this
is intentional, but it is at least highly counterintuitive given the
documentation of that function in the header file:

] /** Combination of tvb_new() and tvb_set_real_data(). Can throw ReportedBoundsError. */
] extern tvbuff_t* tvb_new_real_data(const guint8* data, guint length,
]     gint reported_length);

This suggests that both ways of creating a new REAL_DATA tvbuff are
functionally equivalent. (I ended up with several proto_nodes having
->finfo->ds_tvb == NULL, so the tabbed display wouldn't switch to the
correct data source tab when these nodes were selected.)


Just my two cent, regards,

Jan