aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorSignat Sibirskiy <ord.blant@gmail.com>2020-02-22 13:09:38 -0800
committerAnders Broman <a.broman58@gmail.com>2020-04-19 14:44:27 +0000
commitc6411187a04fcd093bcbdf5003d9ed4a6c7eaacc (patch)
tree967ae22efe0a864a7aabd329b06afa620f355e8c /ui
parentd5ec6882fe1122c9e7cae7a200322381584192a5 (diff)
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 <rknall@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/bluetooth_device_dialog.cpp7
-rw-r--r--ui/qt/bluetooth_devices_dialog.cpp8
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;