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] g_snprintf

From: soumya damodaran <soumya.goodgal@xxxxxxxxx>
Date: Wed, 26 Aug 2009 20:00:24 +0530
Hi
 
    Is it possible to display variable length data using g_snprintf? For the 802.11k AP channel report, the channel list is dependent on the tag_len which is variable.
 

tag_data_ptr = tvb_get_ptr (tvb, offset, tag_len);

for (i = 0, n = 0; i < tag_len; i++) {

ret = g_snprintf (print_buff , SHORT_STR ,

"%02X ", tag_data_ptr[i]);

}

proto_tree_add_string (tree, hf_tag_channel_list, tvb, offset, tag_len, print_buff);

 

right now it is displaying as channel list: <and the last value it is holding>.

i want it to display all the supported channel list as channel list : 1 6  etc. depending  on the tag_len.

Please suggest.

Thanks,

Soumya