aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-at.c
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2016-06-02 16:20:12 +0200
committerPascal Quantin <pascal.quantin@gmail.com>2016-06-02 15:37:58 +0000
commitd53229dbc169143f301625ff44e1ca14ba3ab286 (patch)
tree014f9c45512fca596ebe11156d536c21170aca2c /epan/dissectors/packet-at.c
parentcad300ec92be2b8a69fbbc42e1d117748c008241 (diff)
AT: fix heuristic check
It should loop on captured data, not reported one While we are at it, let's call tvb_format_text_wsp() only once Change-Id: If6805a91d8e5dcf641e682b453522d88cbc2df6c Reviewed-on: https://code.wireshark.org/review/15699 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-at.c')
-rw-r--r--epan/dissectors/packet-at.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/epan/dissectors/packet-at.c b/epan/dissectors/packet-at.c
index aa3b89d402..a03bc00b30 100644
--- a/epan/dissectors/packet-at.c
+++ b/epan/dissectors/packet-at.c
@@ -41,7 +41,7 @@ static gboolean allowed_chars(tvbuff_t *tvb)
gint offset, len;
guint8 val;
- len = tvb_reported_length(tvb);
+ len = tvb_captured_length(tvb);
for (offset = 0; offset < len; offset++) {
val = tvb_get_guint8(tvb, offset);
if (!(g_ascii_isprint(val) || (val == 0x0a) || (val == 0x0d)))
@@ -55,20 +55,19 @@ static int dissect_at(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
{
proto_item *item;
proto_tree *at_tree;
- gint len;
+ gchar *string;
- len = tvb_reported_length(tvb);
+ string = tvb_format_text_wsp(tvb, 0, tvb_captured_length(tvb));
col_append_sep_str(pinfo->cinfo, COL_PROTOCOL, "/", "AT");
- col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "AT Command: %s",
- tvb_format_text_wsp(tvb, 0, len));
+ col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "AT Command: %s", string);
/* Start with a top-level item to add everything else to */
item = proto_tree_add_item(tree, proto_at, tvb, 0, -1, ENC_NA);
+ proto_item_append_text(item, ": %s", string);
at_tree = proto_item_add_subtree(item, ett_at);
/* Command */
- proto_tree_add_item(at_tree, hf_at_command, tvb, 0, len, ENC_ASCII|ENC_NA);
- proto_item_append_text(item, ": %s", tvb_format_text_wsp(tvb, 0, len));
+ proto_tree_add_item(at_tree, hf_at_command, tvb, 0, tvb_reported_length(tvb), ENC_ASCII|ENC_NA);
return tvb_captured_length(tvb);
}