ftp-data: treat \r\n as printable. Also show number of lines in text lines

Change-Id: Icd34030fe023cd52fa7b2df8c506c00d5ced046a
Reviewed-on: https://code.wireshark.org/review/22023
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
This commit is contained in:
Martin Mathieson 2017-06-07 22:17:30 +01:00 committed by Jaap Keuter
parent bd13076643
commit 492da63082
2 changed files with 6 additions and 2 deletions

View File

@ -915,10 +915,11 @@ dissect_ftpdata(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
ti = proto_tree_add_item(tree, proto_ftp_data, tvb, 0, -1, ENC_NA);
/* Check the first few chars to see whether it looks like a text file or not */
/* Check the first few chars to see whether it looks like a text file or output */
check_chars = MIN(10, data_length);
for (i=0; i < check_chars; i++) {
if (!g_ascii_isprint(tvb_get_guint8(tvb, i))) {
guint8 c = tvb_get_guint8(tvb, i);
if (c!='\r' && c!='\n' && !g_ascii_isprint(c)) {
is_text = FALSE;
break;
}

View File

@ -102,6 +102,7 @@ dissect_text_lines(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da
data_name);
if (tree) {
guint lines_read = 0;
ti = proto_tree_add_item(tree, proto_text_lines,
tvb, 0, -1, ENC_NA);
if (data_name)
@ -127,8 +128,10 @@ dissect_text_lines(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da
* line terminator(s) (\r and/or \n) in the display.
*/
proto_tree_add_format_text(subtree, tvb, offset, next_offset - offset);
lines_read++;
offset = next_offset;
}
proto_item_append_text(subtree, " (%u lines)", lines_read);
}
return length;