mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-04 21:24:32 +02:00
fix(esp_https_ota): Check and handle missing image length in OTA HTTP response
This commit is contained in:
@@ -379,6 +379,11 @@ esp_err_t esp_https_ota_begin(const esp_https_ota_config_t *ota_config, esp_http
|
|||||||
}
|
}
|
||||||
|
|
||||||
https_ota_handle->image_length = esp_http_client_get_content_length(https_ota_handle->http_client);
|
https_ota_handle->image_length = esp_http_client_get_content_length(https_ota_handle->http_client);
|
||||||
|
if (https_ota_handle->image_length == -1) {
|
||||||
|
ESP_LOGE(TAG, "Failed to get image length from http response");
|
||||||
|
err = ESP_FAIL;
|
||||||
|
goto http_cleanup;
|
||||||
|
}
|
||||||
#if CONFIG_ESP_HTTPS_OTA_DECRYPT_CB
|
#if CONFIG_ESP_HTTPS_OTA_DECRYPT_CB
|
||||||
/* In case of pre ecnrypted OTA, actual image size of OTA binary includes header size
|
/* In case of pre ecnrypted OTA, actual image size of OTA binary includes header size
|
||||||
* which stored in variable enc_img_header_size */
|
* which stored in variable enc_img_header_size */
|
||||||
|
Reference in New Issue
Block a user