diff options
author | Darien Spencer <cusneud@mail.com> | 2018-08-19 13:09:34 +0300 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2018-08-21 07:26:37 +0000 |
commit | 5673a58bfaf8a580b8868f14d3058dbbbac6f985 (patch) | |
tree | 0d5462c2d5860dc1d525dcb476b3921cd5a2756b /epan/dissectors/packet-at.c | |
parent | 92b4cd586e179dcf5b17f9f5d4f1dfad48f89b57 (diff) |
AT: Fix suffix length checks, add no suffix case
Change-Id: I20a7e52635cf95ea1b5d1c85cd0ae6e8619ebff8
Reviewed-on: https://code.wireshark.org/review/29189
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-at.c')
-rw-r--r-- | epan/dissectors/packet-at.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/epan/dissectors/packet-at.c b/epan/dissectors/packet-at.c index a3de336495..985cb34419 100644 --- a/epan/dissectors/packet-at.c +++ b/epan/dissectors/packet-at.c @@ -1291,6 +1291,7 @@ dissect_at_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint i_char = 0; guint i_char_fix = 0; gint length; + gint leftover_length; const at_cmd_t *i_at_cmd; gint parameter_length; guint parameter_number = 0; @@ -1426,18 +1427,19 @@ dissect_at_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, offset += i_char; + leftover_length = length - i_char; if (i_at_cmd && g_strcmp0(i_at_cmd->name, "D")) { - if (length >= 2 && at_command[i_char] == '=' && at_command[i_char + 1] == '?') { + if (leftover_length >= 2 && at_command[i_char] == '=' && at_command[i_char + 1] == '?') { type = at_command[i_char] << 8 | at_command[i_char + 1]; proto_tree_add_uint(command_tree, hf_at_cmd_type, tvb, offset, 2, type); offset += 2; i_char += 2; - } else if (role == ROLE_DCE && length >= 2 && at_command[i_char] == '\r' && at_command[i_char + 1] == '\n') { + } else if (role == ROLE_DCE && leftover_length >= 2 && at_command[i_char] == '\r' && at_command[i_char + 1] == '\n') { type = at_command[i_char] << 8 | at_command[i_char + 1]; proto_tree_add_uint(command_tree, hf_at_cmd_type, tvb, offset, 2, type); offset += 2; i_char += 2; - } else if (length >= 1 && (at_command[i_char] == '=' || + } else if (leftover_length >= 1 && (at_command[i_char] == '=' || at_command[i_char] == '\r' || at_command[i_char] == ':' || at_command[i_char] == '?')) { @@ -1446,6 +1448,12 @@ dissect_at_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, offset += 1; i_char += 1; } + else if (leftover_length == 0) { + /* No suffix, assume line break (which translates to 'ACTION_SIMPLY') */ + type = TYPE_ACTION_SIMPLY; + pitem = proto_tree_add_uint(command_tree, hf_at_cmd_type, tvb, offset, 0, type); + PROTO_ITEM_SET_GENERATED(pitem); + } } if (i_at_cmd && i_at_cmd->check_command && !i_at_cmd->check_command(role, type)) { |