aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-catapult-dct2000.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors/packet-catapult-dct2000.c')
-rw-r--r--epan/dissectors/packet-catapult-dct2000.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/epan/dissectors/packet-catapult-dct2000.c b/epan/dissectors/packet-catapult-dct2000.c
index cd06455422..c24b5c28c1 100644
--- a/epan/dissectors/packet-catapult-dct2000.c
+++ b/epan/dissectors/packet-catapult-dct2000.c
@@ -1536,14 +1536,15 @@ static void dissect_tty_lines(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
int n, idx;
char *hex_string;
int tty_string_length = tvb_length_remaining(tvb, offset);
- hex_string = ep_alloc(1+(2*tty_string_length)+1);
+ int hex_string_length = 1+(2*tty_string_length)+1;
+ hex_string = ep_alloc(hex_string_length);
- idx = sprintf(hex_string, "$");
+ idx = g_snprintf(hex_string, hex_string_length, "$");
/* Write hex out to new string */
for (n=0; n < tty_string_length; n++) {
- idx += sprintf(hex_string+idx, "%02x",
- tvb_get_guint8(tvb, offset+n));
+ idx += g_snprintf(hex_string+idx, 3, "%02x",
+ tvb_get_guint8(tvb, offset+n));
}
string = hex_string;
}