Browse Source

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.
pull/6184/head
Thomas Friebel 4 years ago
committed by Damien George
parent
commit
b6146ca1a1
  1. 2
      extmod/nimble/modbluetooth_nimble.c

2
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;
}

Loading…
Cancel
Save