Skip to content

Commit ec0865c

Browse files
chengkai15danieldegrasse
authored andcommitted
Bluetooth: SDP: fix attr value len 32 invalid
fix sdp attr value len 32, which was not supported. Signed-off-by: Cheng Kai <chengkai@xiaomi.com>
1 parent d7d3ae5 commit ec0865c

File tree

1 file changed

+10
-0
lines changed
  • subsys/bluetooth/host/classic

1 file changed

+10
-0
lines changed

subsys/bluetooth/host/classic/sdp.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2588,6 +2588,16 @@ static inline ssize_t sdp_get_seq_len(const uint8_t *data, size_t len)
25882588
return 3 + sys_get_be16(pnext);
25892589
case BT_SDP_SEQ32:
25902590
case BT_SDP_ALT32:
2591+
/* validate len for pnext safe use to read 32bit value */
2592+
if (len < 5) {
2593+
break;
2594+
}
2595+
2596+
if (len < (5 + sys_get_be32(pnext))) {
2597+
break;
2598+
}
2599+
2600+
return 5 + sys_get_be32(pnext);
25912601
default:
25922602
LOG_ERR("Invalid/unhandled DTD 0x%02x", data[0]);
25932603
return -EINVAL;

0 commit comments

Comments
 (0)