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

Wireshark-dev: Re: [Wireshark-dev] g_snprintf

From: wsgd <wsgd@xxxxxxx>
Date: Wed, 26 Aug 2009 20:54:06 +0200
soumya damodaran a �crit :
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);

strcpy(print_buff, "");
for (i = 0, n = 0; i < tag_len; i++) {
char    print_buff_idx[10];

ret = g_snprintf (print_buff_idx , SHORT_STR ,

"%02X ", tag_data_ptr[i]);
strcat(print_buff, print_buff_idx);

}

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

------------------------------------------------------------------------

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe