From c6411187a04fcd093bcbdf5003d9ed4a6c7eaacc Mon Sep 17 00:00:00 2001 From: Signat Sibirskiy Date: Sat, 22 Feb 2020 13:09:38 -0800 Subject: [PATCH] Qt: Fix filling bluetooth device address When filling bd_addr from tap_device->bd_addr[], only the first octet was used Change-Id: I3cb281d96126d77e5e6862e44704c7f9ab34cb78 Reviewed-on: https://code.wireshark.org/review/36152 Petri-Dish: Roland Knall Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall Reviewed-by: Anders Broman --- ui/qt/bluetooth_device_dialog.cpp | 7 ++++--- ui/qt/bluetooth_devices_dialog.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ui/qt/bluetooth_device_dialog.cpp b/ui/qt/bluetooth_device_dialog.cpp index 77c4c98328..47435dfba6 100644 --- a/ui/qt/bluetooth_device_dialog.cpp +++ b/ui/qt/bluetooth_device_dialog.cpp @@ -395,9 +395,10 @@ tap_packet_status BluetoothDeviceDialog::tapPacket(void *tapinfo_ptr, packet_inf } if (tap_device->has_bd_addr) { - for (int i = 0; i < 6; ++i) - bd_addr += QString("%1:").arg(tap_device->bd_addr[0], 2, 16, QChar('0')); - bd_addr.remove(bd_addr.length() - 1, 1); + for (int i = 0; i < 6; ++i) { + bd_addr += QString("%1:").arg(tap_device->bd_addr[i], 2, 16, QChar('0')); + } + bd_addr.chop(1); // remove extra character ":" from the end of the string if (!tap_device->is_local && bd_addr != tapinfo->bdAddr) return TAP_PACKET_REDRAW; diff --git a/ui/qt/bluetooth_devices_dialog.cpp b/ui/qt/bluetooth_devices_dialog.cpp index d8b556da67..09364f8e70 100644 --- a/ui/qt/bluetooth_devices_dialog.cpp +++ b/ui/qt/bluetooth_devices_dialog.cpp @@ -286,10 +286,10 @@ tap_packet_status BluetoothDevicesDialog::tapPacket(void *tapinfo_ptr, packet_in } if (tap_device->has_bd_addr) { - for (int i = 0; i < 6; ++i) - bd_addr += QString("%1:").arg(tap_device->bd_addr[0], 2, 16, QChar('0')); - bd_addr.remove(bd_addr.length() - 1, 1); - + for (int i = 0; i < 6; ++i) { + bd_addr += QString("%1:").arg(tap_device->bd_addr[i], 2, 16, QChar('0')); + } + bd_addr.chop(1); // remove extra character ":" from the end of the string manuf = get_ether_name(tap_device->bd_addr); if (manuf) { int pos;