Skip to content

Commit 56ec1d8

Browse files
MariuszSkamrajhedberg
authored andcommitted
Bluetooth: tester: Fix possible NULL pointer dereference
Fix calling NULL attribute read function pointer. Signed-off-by: Mariusz Skamra <[email protected]>
1 parent 3ab275f commit 56ec1d8

File tree

1 file changed

+5
-0
lines changed
  • tests/bluetooth/tester/src

1 file changed

+5
-0
lines changed

tests/bluetooth/tester/src/gatt.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1820,6 +1820,11 @@ static u8_t get_attr_val_rp(const struct bt_gatt_attr *attr, void *user_data)
18201820
do {
18211821
to_read = net_buf_simple_tailroom(buf);
18221822

1823+
if (!attr->read) {
1824+
rp->att_response = BT_ATT_ERR_READ_NOT_PERMITTED;
1825+
break;
1826+
}
1827+
18231828
read = attr->read(NULL, attr, buf->data + buf->len, to_read,
18241829
rp->value_length);
18251830
if (read < 0) {

0 commit comments

Comments
 (0)