aboutsummaryrefslogtreecommitdiff
path: root/extmod
diff options
context:
space:
mode:
authorThomas Friebel2020-07-05 16:48:27 +0200
committerDamien George2020-07-09 22:41:10 +1000
commitb6146ca1a11d9db6fa2276920f2c3c32d9bc4457 (patch)
tree8e6bf45c946d9578e630978f8c05eba000bb522c /extmod
parentc299cc94e334a5a9576e15e0f046e24810c4c75a (diff)
extmod/nimble: Fix attr NULL ptr dereference in ble_gatt_attr_read_cb.
In case of error, NimBLE calls the read callback with attr = NULL.
Diffstat (limited to 'extmod')
-rw-r--r--extmod/nimble/modbluetooth_nimble.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/extmod/nimble/modbluetooth_nimble.c b/extmod/nimble/modbluetooth_nimble.c
index 4e0ca88ef..be7d13d9e 100644
--- a/extmod/nimble/modbluetooth_nimble.c
+++ b/extmod/nimble/modbluetooth_nimble.c
@@ -846,7 +846,7 @@ STATIC int ble_gatt_attr_read_cb(uint16_t conn_handle, const struct ble_gatt_err
if (error->status == 0) {
gattc_on_data_available(MP_BLUETOOTH_IRQ_GATTC_READ_RESULT, conn_handle, attr->handle, attr->om);
}
- mp_bluetooth_gattc_on_read_write_status(MP_BLUETOOTH_IRQ_GATTC_READ_DONE, conn_handle, attr->handle, error->status);
+ mp_bluetooth_gattc_on_read_write_status(MP_BLUETOOTH_IRQ_GATTC_READ_DONE, conn_handle, attr ? attr->handle : -1, error->status);
return 0;
}