Skip to content

Commit

Permalink
Bluetooth: tester: Fix possible NULL pointer dereference
Browse files Browse the repository at this point in the history
Fix calling NULL attribute read function pointer.

Signed-off-by: Mariusz Skamra <[email protected]>
  • Loading branch information
MariuszSkamra authored and jhedberg committed Mar 19, 2019
1 parent 3ab275f commit 56ec1d8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/bluetooth/tester/src/gatt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1820,6 +1820,11 @@ static u8_t get_attr_val_rp(const struct bt_gatt_attr *attr, void *user_data)
do {
to_read = net_buf_simple_tailroom(buf);

if (!attr->read) {
rp->att_response = BT_ATT_ERR_READ_NOT_PERMITTED;
break;
}

read = attr->read(NULL, attr, buf->data + buf->len, to_read,
rp->value_length);
if (read < 0) {
Expand Down

0 comments on commit 56ec1d8

Please sign in to comment.