Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions components/claw_capabilities/cap_im_platform/src/cap_im_tg.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ static bool cap_im_tg_dedup_check_and_record(const char *update_key)
return false;
}

#define CAP_IM_TG_MAX_RESP_SIZE (64U * 1024U)

Comment on lines +131 to +132
static esp_err_t cap_im_tg_http_event_handler(esp_http_client_event_t *event)
{
cap_im_tg_http_resp_t *resp = (cap_im_tg_http_resp_t *)event->user_data;
Expand All @@ -136,6 +138,10 @@ static esp_err_t cap_im_tg_http_event_handler(esp_http_client_event_t *event)
return ESP_OK;
}

if (resp->len + (size_t)event->data_len + 1 > CAP_IM_TG_MAX_RESP_SIZE) {
return ESP_ERR_NO_MEM;
}
Comment on lines +141 to +143

if (resp->len + (size_t)event->data_len + 1 > resp->cap) {
char *tmp = NULL;
size_t new_cap = resp->cap * 2;
Expand Down