aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-rlogin.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2004-07-23 07:59:15 +0000
committerGuy Harris <guy@alum.mit.edu>2004-07-23 07:59:15 +0000
commit89f9e1ee8840a88547bb7167db0039ab2ca675a0 (patch)
tree509e3163ff89cb642908aa0e38c1c869992b3e50 /epan/dissectors/packet-rlogin.c
parent1b0f6edbd974e572d85a5871e69bd5ea491504c4 (diff)
Use "col_append_str()" and "col_append_fstr()" to build the Info column,
rather than building a string, and use "tvb_format_text()" on the data, so that non-printable characters are escaped. svn path=/trunk/; revision=11480
Diffstat (limited to 'epan/dissectors/packet-rlogin.c')
-rw-r--r--epan/dissectors/packet-rlogin.c41
1 files changed, 18 insertions, 23 deletions
diff --git a/epan/dissectors/packet-rlogin.c b/epan/dissectors/packet-rlogin.c
index 5f09780830..29e44d29a2 100644
--- a/epan/dissectors/packet-rlogin.c
+++ b/epan/dissectors/packet-rlogin.c
@@ -359,49 +359,44 @@ dissect_rlogin(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_set_str(pinfo->cinfo, COL_PROTOCOL, "Rlogin");
if (check_col(pinfo->cinfo, COL_INFO)){ /* display packet info*/
-
- char temp[1000];
-
- col_clear(pinfo->cinfo, COL_INFO);
if ( hash_info->name[0]) {
- strcpy( temp, "User name: ");
- strcat( temp, hash_info->name);
- strcat( temp, ", ");
+ col_add_fstr(pinfo->cinfo, COL_INFO,
+ "User name: %s, ", hash_info->name);
}
else
- temp[0] = 0;
+ col_clear(pinfo->cinfo, COL_INFO);
length = tvb_length(tvb);
if (length != 0) {
- if ( tvb_get_guint8(tvb, 0) == '\0')
- strcat( temp, "Start Handshake");
+ if ( tvb_get_guint8(tvb, 0) == '\0') {
+ col_append_str(pinfo->cinfo, COL_INFO,
+ "Start Handshake");
+ }
else if ( tcpinfo->urgent &&
- length >= tcpinfo->urgent_pointer )
- strcat( temp, "Control Message");
-
+ length >= tcpinfo->urgent_pointer ) {
+ col_append_str(pinfo->cinfo, COL_INFO,
+ "Control Message");
+ }
else { /* check for terminal info */
ti_offset = tvb_find_guint8(tvb, 0, -1, 0xff);
if (ti_offset != -1 &&
tvb_bytes_exist(tvb, ti_offset + 1, 1) &&
- tvb_get_guint8(tvb, ti_offset + 1) == 0xff)
- strcat( temp, "Terminal Info");
+ tvb_get_guint8(tvb, ti_offset + 1) == 0xff) {
+ col_append_str(pinfo->cinfo, COL_INFO,
+ "Terminal Info");
+ }
else {
- int i;
int bytes_to_copy;
- strcat( temp, "Data: ");
- i = strlen( temp);
bytes_to_copy = tvb_length(tvb);
if (bytes_to_copy > 128)
bytes_to_copy = 128;
- tvb_memcpy(tvb, (guint8 *)&temp[i], 0,
- bytes_to_copy);
- temp[i + bytes_to_copy] = '\0';
+ col_append_fstr(pinfo->cinfo, COL_INFO,
+ "Data: %s",
+ tvb_format_text(tvb, 0, bytes_to_copy));
}
}
}
-
- col_add_str(pinfo->cinfo, COL_INFO, temp);
}
rlogin_state_machine( hash_info, tvb, pinfo);