Merge branch 'bugfix/esp_spp_write_len_0_v4.1' into 'release/v4.1'

bt: Fixed esp_spp_write() crash when len is 0 (v4.1)

See merge request espressif/esp-idf!20709
This commit is contained in:
Jiang Jiang Jian 2022-10-24 12:31:22 +08:00
commit 5fbc8774b6

View File

@ -195,6 +195,11 @@ esp_err_t esp_spp_write(uint32_t handle, int len, uint8_t *p_data)
btc_spp_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
if (len <= 0 || p_data == NULL) {
LOG_ERROR("Invalid data or len!\n");
return ESP_ERR_INVALID_ARG;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_SPP;
msg.act = BTC_SPP_ACT_WRITE;