aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-dect.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2009-03-28 17:30:31 +0000
committerGuy Harris <guy@alum.mit.edu>2009-03-28 17:30:31 +0000
commitc023fe9066dd14069af3d7fc5fd5612005a8ccd9 (patch)
tree8898b9de3acc63bdc7f0a1ad99f17609061c2977 /epan/dissectors/packet-dect.c
parent6c6c89e835a55f05129256991db7bd847cd67769 (diff)
Don't use sprintf() - use ep_strbufs and ep_strbuf_append_printf()
instead. svn path=/trunk/; revision=27876
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