aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-gtp.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2008-02-29 03:32:58 +0000
committerGuy Harris <guy@alum.mit.edu>2008-02-29 03:32:58 +0000
commit6d61024a550eb568fcbdde8396d1ad23886457c9 (patch)
treeec1776227659ba0135fbbdf3c8ccc8fcb75a0c38 /epan/dissectors/packet-gtp.c
parentbef5e5c9fca2cf914194624cecf1e13606f9de05 (diff)
Don't peek inside the column information and manually wrap "GTP < ... >"
around the protocol field, use the standard routines for prepending to and appending to a column. That should fix bug 2311, as the standard routines use g_strlcat(), and should also keep that code robust in the face of changes to the way columns are implemented. svn path=/trunk/; revision=24502
Diffstat (limited to 'epan/dissectors/packet-gtp.c')
-rw-r--r--epan/dissectors/packet-gtp.c35
1 files changed, 4 insertions, 31 deletions
diff --git a/epan/dissectors/packet-gtp.c b/epan/dissectors/packet-gtp.c
index fadc38bcd4..a959a2c4f7 100644
--- a/epan/dissectors/packet-gtp.c
+++ b/epan/dissectors/packet-gtp.c
@@ -1576,35 +1576,6 @@ struct _gtp_hdr {
static guint8 gtp_version = 0;
static const char *yesno[] = { "no", "yes" };
-static void
-col_append_str_gtp(column_info *cinfo, gint el, const gchar *proto_name) {
-
- int i;
- int max_len;
- gchar _tmp[COL_MAX_LEN];
-
- max_len = COL_MAX_LEN;
-
- for (i = 0; i < cinfo->num_cols; i++) {
- if (cinfo->fmt_matx[i][el]) {
- if (cinfo->col_data[i] != cinfo->col_buf[i]) {
-
- strncpy(cinfo->col_buf[i], cinfo->col_data[i], max_len);
- cinfo->col_buf[i][max_len - 1] = '\0';
- }
-
- _tmp[0] = '\0';
- strncat(_tmp, proto_name, COL_MAX_LEN);
- strncat(_tmp, " <", COL_MAX_LEN - strlen(_tmp));
- strncat(_tmp, cinfo->col_buf[i], COL_MAX_LEN - strlen(_tmp));
- strncat(_tmp, ">", COL_MAX_LEN - strlen(_tmp));
- cinfo->col_buf[i][0] = '\0';
- strncat(cinfo->col_buf[i], _tmp, COL_MAX_LEN);
- cinfo->col_data[i] = cinfo->col_buf[i];
- }
- }
-}
-
static gchar *
id_to_str(const guint8 *ad) {
@@ -6054,8 +6025,10 @@ dissect_gtp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
call_dissector (ppp_handle, next_tvb, pinfo, tree);
}
- if (check_col(pinfo->cinfo, COL_PROTOCOL))
- col_append_str_gtp(pinfo->cinfo, COL_PROTOCOL, "GTP");
+ if (check_col(pinfo->cinfo, COL_PROTOCOL)) {
+ col_prepend_fstr(pinfo->cinfo, COL_PROTOCOL, "GTP <");
+ col_append_str(pinfo->cinfo, COL_PROTOCOL, ">");
+ }
}
}