aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-fclctl.c
diff options
context:
space:
mode:
authorsahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>2005-10-27 09:35:14 +0000
committersahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>2005-10-27 09:35:14 +0000
commit54f7c7a839b48139435b04d19bc71d19bb61a57c (patch)
treebddffb47ce20b821b05d1b414854247c306dfc12 /epan/dissectors/packet-fclctl.c
parentb189171cd1b8cce54e1843aafa7e74803b1473be (diff)
get rid of some strcpy
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16338 f5534014-38df-0310-8fa8-9805f1628bb7
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);