aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-adb.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2018-02-25 17:53:21 +0100
committerAnders Broman <a.broman58@gmail.com>2018-02-27 09:10:28 +0000
commitba0f4b9d9f954c985cd260feeae4560b5f54668a (patch)
treee2dffe7769db35f8f227fc443e34b98fbfee4bc0 /epan/dissectors/packet-adb.c
parent61d033645d7b146c2535fce8ed1cbb6272dde2d7 (diff)
adb: fix Malformed packet while parsing CONNECT command
Previous adb versions included a NULL terminator in the banner, but this is not required by the specification[1] and in newer versions there is no such terminator. This patch fixes issue 1 of bug 14460. [1]: https://android.googlesource.com/platform/system/core/+/android-8.1.0_r7/adb/protocol.txt#56 Change-Id: I0a3ad1499d68d38c430dd386854ddba0ce755538 Ping-Bug: 14460 Reviewed-on: https://code.wireshark.org/review/26097 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-adb.c')
-rw-r--r--epan/dissectors/packet-adb.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/epan/dissectors/packet-adb.c b/epan/dissectors/packet-adb.c
index 9e6f955cb9..58cce39c02 100644
--- a/epan/dissectors/packet-adb.c
+++ b/epan/dissectors/packet-adb.c
@@ -683,13 +683,18 @@ dissect_adb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
col_append_fstr(pinfo->cinfo, COL_INFO, "Service: %s", tvb_get_stringz_enc(wmem_packet_scope(), tvb, offset, NULL, ENC_ASCII));
offset = tvb_captured_length(tvb);
} else if (command_data && command_data->command == A_CNXN) {
- gchar *info;
- gint len;
+ const guint8 *info;
- info = tvb_get_stringz_enc(wmem_packet_scope(), tvb, offset, &len, ENC_ASCII);
+ /*
+ * Format: "<systemtype>:<serialno>:<banner>".
+ * Previously adb used "device::ro.product.name=...;...;\0" as
+ * human-readable banner, but since platform/system/core commit
+ * 1792c23cb8 (2015-05-18) it is a ";"-separated feature list.
+ */
+
+ proto_tree_add_item_ret_string(main_tree, hf_connection_info, tvb, offset, -1, ENC_ASCII | ENC_NA, wmem_packet_scope(), &info);
col_append_fstr(pinfo->cinfo, COL_INFO, "Connection Info: %s", info);
- proto_tree_add_item(main_tree, hf_connection_info, tvb, offset, len, ENC_ASCII | ENC_NA);
- offset += len;
+ offset = tvb_captured_length(tvb);
} else {
col_append_str(pinfo->cinfo, COL_INFO, "Data");
@@ -858,7 +863,7 @@ proto_register_adb(void)
},
{ &hf_connection_info,
{ "Info", "adb.connection_info",
- FT_STRINGZ, STR_ASCII, NULL, 0x00,
+ FT_STRING, STR_ASCII, NULL, 0x00,
NULL, HFILL }
}
};