aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-fclctl.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2005-10-27 09:35:14 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2005-10-27 09:35:14 +0000
commitaa7627a8d1db46cd3d0aa5725a9514bd10a7c3c7 (patch)
treebddffb47ce20b821b05d1b414854247c306dfc12 /epan/dissectors/packet-fclctl.c
parente876bc7d6849ce79b4225c96b774370d4d3ad3b4 (diff)
get rid of some strcpy
svn path=/trunk/; revision=16338
Diffstat (limited to 'epan/dissectors/packet-fclctl.c')
-rw-r--r--epan/dissectors/packet-fclctl.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/epan/dissectors/packet-fclctl.c b/epan/dissectors/packet-fclctl.c
index 8f87bb386b..9839daa9f3 100644
--- a/epan/dissectors/packet-fclctl.c
+++ b/epan/dissectors/packet-fclctl.c
@@ -42,6 +42,7 @@
#include <glib.h>
#include <epan/packet.h>
+#include <epan/emem.h>
#include <epan/etypes.h>
#include "packet-fc.h"
#include "packet-fclctl.h"
@@ -126,8 +127,6 @@ static const value_string fc_lctl_rjt_val[] = {
{0, NULL},
};
-static gchar errstr[64];
-
const gchar *
fclctl_get_typestr (guint8 linkctl_type, guint8 type)
{
@@ -141,31 +140,22 @@ fclctl_get_typestr (guint8 linkctl_type, guint8 type)
gchar *
fclctl_get_paramstr (guint32 linkctl_type, guint32 param)
{
- int len;
-
+ gchar *errstr;
+
+#define MAX_ERRSTR_LEN 64
+ errstr=ep_alloc(MAX_ERRSTR_LEN);
errstr[0] = '\0';
if (linkctl_type == FC_LCTL_PBSY) {
- strcpy (errstr, val_to_str (((param & 0xFF000000) >> 24),
- fc_lctl_pbsy_acode_val, "0x%x"));
- len = strlen (errstr);
- strcpy (&errstr[len], ", ");
- len = strlen (errstr);
- strcpy (&errstr[len],
- val_to_str (((param & 0x00FF0000) >> 16),
- fc_lctl_pbsy_rjt_val, "0x%x"));
+ g_snprintf(errstr, MAX_ERRSTR_LEN, "%s, %s",
+ val_to_str (((param & 0xFF000000) >> 24), fc_lctl_pbsy_acode_val, "0x%x"),
+ val_to_str (((param & 0x00FF0000) >> 16), fc_lctl_pbsy_rjt_val, "0x%x"));
}
else if ((linkctl_type == FC_LCTL_FRJT) ||
(linkctl_type == FC_LCTL_PRJT)) {
- strcpy (errstr,
- val_to_str (((param & 0xFF000000) >> 24),
- fc_lctl_rjt_acode_val, "0x%x"));
- len = strlen (errstr);
- strcpy (&errstr[len], ", ");
- len = strlen (errstr);
- strcpy (&errstr[len],
- val_to_str (((param & 0x00FF0000) >> 16), fc_lctl_rjt_val,
- "%x"));
+ g_snprintf(errstr, MAX_ERRSTR_LEN, "%s, %s",
+ val_to_str (((param & 0xFF000000) >> 24), fc_lctl_rjt_acode_val, "0x%x"),
+ val_to_str (((param & 0x00FF0000) >> 16), fc_lctl_rjt_val, "%x"));
}
return (errstr);