aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-rpc.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2005-10-15 22:36:59 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2005-10-15 22:36:59 +0000
commit24cc5e865a7659260f8f11c5c85f8092e9990e1a (patch)
tree6f1cbd1aac0f82d6a5a690f2e7c4ef6ed8362334 /epan/dissectors/packet-rpc.c
parentef50c122751e3f0a375e04c8dac329c97d50d14e (diff)
get rid of one strcpy() and one strcat()
svn path=/trunk/; revision=16227
Diffstat (limited to 'epan/dissectors/packet-rpc.c')
-rw-r--r--epan/dissectors/packet-rpc.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/epan/dissectors/packet-rpc.c b/epan/dissectors/packet-rpc.c
index 3e8844b780..3b7bde3a39 100644
--- a/epan/dissectors/packet-rpc.c
+++ b/epan/dissectors/packet-rpc.c
@@ -634,18 +634,10 @@ dissect_rpc_opaque_data(tvbuff_t *tvb, int offset,
formatted = format_text(string_buffer, strlen(string_buffer));
/* alloc maximum data area */
- string_buffer_print = (char*)ep_alloc(strlen(formatted) + 12 + 1);
- /* copy over the data */
- strcpy(string_buffer_print,formatted);
- /* append <TRUNCATED> */
- /* This way, we get the TRUNCATED even
- in the case of totally wrong packets,
- where \0 are inside the string.
- TRUNCATED will appear at the
- first \0 or at the end (where we
- put the securing \0).
- */
- strcat(string_buffer_print,"<TRUNCATED>");
+#define STRING_BUFFER_PRINT_MAX_LEN (strlen(formatted)+12+1)
+ string_buffer_print = (char*)ep_alloc(STRING_BUFFER_PRINT_MAX_LEN);
+ /* copy over the data and append <TRUNCATED> */
+ g_snprintf(string_buffer_print, STRING_BUFFER_PRINT_MAX_LEN, "%s<TRUNCATED>", formatted);
} else {
string_buffer_print="<DATA><TRUNCATED>";
}