Skip to content

Commit

Permalink
bt: Fixed esp_spp_write() crash when len is 0
Browse files Browse the repository at this point in the history
Closes #9977
  • Loading branch information
xiongweichao committed Oct 26, 2022
1 parent dbcf640 commit 47232f5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions components/bt/host/bluedroid/api/esp_spp_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,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;
Expand Down

0 comments on commit 47232f5

Please sign in to comment.