forked from osmocom/wireshark
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>
This commit is contained in:
parent
92b4cd586e
commit
5673a58bfa
|
@ -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)) {
|
||||
|
|
Loading…
Reference in New Issue