summaryrefslogtreecommitdiff
path: root/monitor/avctp.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2014-08-25 17:14:09 +0300
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2014-08-26 13:24:38 +0300
commit8bcfc8b71b36015093b44d0edf9d283cd21ee1a5 (patch)
tree1a23e0e5c91c26a6c963dfac3ab8189f251a1b98 /monitor/avctp.c
parent3423d22f99cd6851f31b0923bfcce466c3033958 (diff)
downloadbluez-8bcfc8b71b36015093b44d0edf9d283cd21ee1a5.tar.gz
monitor/avctp: Fix parsing of Company ID capability
Diffstat (limited to 'monitor/avctp.c')
-rw-r--r--monitor/avctp.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/monitor/avctp.c b/monitor/avctp.c
index 87ad49e71..be21cd7f8 100644
--- a/monitor/avctp.c
+++ b/monitor/avctp.c
@@ -512,10 +512,18 @@ static bool avrcp_get_capabilities(struct l2cap_frame *frame, uint8_t ctype,
switch (cap) {
case 0x2:
for (; count > 0; count--) {
- print_field("%s: 0x", cap2str(cap));
- for (i = 0; i < 3; i++)
- print_field("%*c%02x", (indent - 8), ' ',
- *((uint8_t *) (frame->data + 2 + i)));
+ uint8_t company[3] = {};
+
+ if (frame->size < 3)
+ return false;
+
+ l2cap_frame_get_u8(frame, &company[0]);
+ l2cap_frame_get_u8(frame, &company[1]);
+ l2cap_frame_get_u8(frame, &company[2]);
+
+ print_field("%*c%s: 0x%02x%02x%02x", (indent - 8), ' ',
+ cap2str(cap), company[0], company[1],
+ company[2]);
}
break;
case 0x3: