aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-dect.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2009-03-28 17:30:31 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2009-03-28 17:30:31 +0000
commit6a9b75df80511082c2d0af1b7cb8b5ee0b9d08de (patch)
tree8898b9de3acc63bdc7f0a1ad99f17609061c2977 /epan/dissectors/packet-dect.c
parent70dc054e99e303a2506cd13fd7c1bdd48bd1fbb9 (diff)
Don't use sprintf() - use ep_strbufs and ep_strbuf_append_printf()
instead. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@27876 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-dect.c')
-rw-r--r--epan/dissectors/packet-dect.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/epan/dissectors/packet-dect.c b/epan/dissectors/packet-dect.c
index 100bc03556..004731cf78 100644
--- a/epan/dissectors/packet-dect.c
+++ b/epan/dissectors/packet-dect.c
@@ -872,18 +872,21 @@ dissect_bfield(gboolean dect_packet_type _U_, struct dect_afield *pkt_afield,
guint16 x, y=0;
for(x=0;x<blen;x+=16)
{
- /*gchar string[60];*/
- gchar string[145];
- string[0]='\0';
+ /*
+ * XXX - should this just be an FTYPE_BYTES field,
+ * and possibly just displayed as "Data: N bytes"
+ * rather than giving all the bytes of data?
+ */
+ emem_strbuf_t *string;
+ string = ep_strbuf_new(NULL);
for(y=0;y<16;y++)
{
if((x+y)>=blen)
break;
- /*g_snprintf(string, sizeof(string), "%s%.2x ", string, pkt_bfield->Data[x+y]);*/
- sprintf(string,"%s%.2x ", string, pkt_bfield->Data[x+y]);
+ ep_strbuf_append_printf(string,"%.2x ", pkt_bfield->Data[x+y]);
}
- proto_tree_add_uint_format(BField, hf_dect_B_Data, tvb, offset, y, 0x2323, "Data: %s", string);
+ proto_tree_add_uint_format(BField, hf_dect_B_Data, tvb, offset, y, 0x2323, "Data: %s", string->str);
if(y==16)
offset+=16;
else
@@ -899,19 +902,23 @@ dissect_bfield(gboolean dect_packet_type _U_, struct dect_afield *pkt_afield,
proto_tree_add_uint_format(BField, hf_dect_B_Data, tvb, offset, y, 0x2323, "Framenumber %u/%u", fn, fn+8);
for(x=0;x<blen;x+=16)
{
- /*gchar string[60];*/
- gchar string[145];
- string[0]='\0';
+ /*
+ * XXX - should this just be an FTYPE_BYTES
+ * field, and possibly just displayed as
+ * "Data: N bytes" rather than giving all
+ * the bytes of data?
+ */
+ emem_strbuf_t *string;
+ string = ep_strbuf_new(NULL);
for(y=0;y<16;y++)
{
if((x+y)>=blen)
break;
- /*g_snprintf(string, sizeof(string), "%s%.2x ", string, pkt_bfield->Data[x+y]^scrt[fn][bytecount%31]);*/
- sprintf(string,"%s%.2x ", string, pkt_bfield->Data[x+y]^scrt[fn][bytecount%31]);
+ ep_strbuf_append_printf(string,"%.2x ", pkt_bfield->Data[x+y]^scrt[fn][bytecount%31]);
bytecount++;
}
- proto_tree_add_uint_format(BField, hf_dect_B_Data, tvb, offset, y, 0x2323, "Data: %s", string);
+ proto_tree_add_uint_format(BField, hf_dect_B_Data, tvb, offset, y, 0x2323, "Data: %s", string->str);
if(y==16)
offset+=16;
else