monitor: Fix printing Signed Write Command
authorSimon Mikuda <simon.mikuda@streamunlimited.com>
Thu, 23 Mar 2023 10:28:58 +0000 (11:28 +0100)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 5 Jan 2024 10:41:34 +0000 (16:11 +0530)
Data field were print twice (1 time incorrectly):
> ACL Data RX: Handle 64 flags 0x02 dlen 19
      ATT: Signed Write Command (0xd2) len 14
        Handle: 0x006f Type: Vendor specific (f7debc9a-7856-3412-7856-341278563412)
          Data: 0800000087f303c224516133
          Data:
          Signature: 0800000087f303c224516133

monitor/att.c

index cd319cf..ef193f9 100644 (file)
@@ -2933,13 +2933,14 @@ static void print_write(const struct l2cap_frame *frame, uint16_t handle,
        struct gatt_handler *handler;
 
        print_handle(frame, handle, false);
-       print_hex_field("  Data", frame->data, frame->size);
 
        if (len > frame->size) {
                print_text(COLOR_ERROR, "invalid size");
                return;
        }
 
+       print_hex_field("  Data", frame->data, len);
+
        attr = get_attribute(frame, handle, false);
        if (!attr)
                return;
@@ -3104,7 +3105,6 @@ static void att_signed_write_command(const struct l2cap_frame *frame)
        }
 
        print_write(frame, handle, frame->size - 12);
-       print_hex_field("  Data", frame->data, frame->size - 12);
        print_hex_field("  Signature", frame->data + frame->size - 12, 12);
 }