Skip to content

Commit 3e46a73

Browse files
committed
fix(esp_https_ota): Check and handle missing image length in OTA HTTP response
1 parent 1f4612e commit 3e46a73

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

components/esp_https_ota/src/esp_https_ota.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,11 @@ esp_err_t esp_https_ota_begin(const esp_https_ota_config_t *ota_config, esp_http
379379
}
380380

381381
https_ota_handle->image_length = esp_http_client_get_content_length(https_ota_handle->http_client);
382+
if (https_ota_handle->image_length == -1) {
383+
ESP_LOGE(TAG, "Failed to get image length from http response");
384+
err = ESP_FAIL;
385+
goto http_cleanup;
386+
}
382387
#if CONFIG_ESP_HTTPS_OTA_DECRYPT_CB
383388
/* In case of pre ecnrypted OTA, actual image size of OTA binary includes header size
384389
* which stored in variable enc_img_header_size */

0 commit comments

Comments
 (0)