]> granicus.if.org Git - esp-idf/commitdiff
bugfix/ota_magic_byte_issue: Fix indent and replace constant by macro
authorSupreet Deshpande <supreet.deshpande@espressif.com>
Mon, 17 Dec 2018 04:26:18 +0000 (09:56 +0530)
committerSupreet Deshpande <supreet.deshpande@espressif.com>
Mon, 17 Dec 2018 04:26:18 +0000 (09:56 +0530)
Replace 0xE9 by ESP_IMAGE_HEADER_MAGIC.

components/app_update/esp_ota_ops.c

index 40cd89d49c386279d9957bb724e28a5b2f050b21..6e8998d323f1e0e575ae3a29a0b3d9476eda3924 100644 (file)
@@ -183,7 +183,7 @@ esp_err_t esp_ota_write(esp_ota_handle_t handle, const void *data, size_t size)
         if (it->handle == handle) {
             // must erase the partition before writing to it
             assert(it->erased_size > 0 && "must erase the partition before writing to it");
-            if(it->wrote_size == 0 && it->partial_bytes == 0 && size > 0 && data_bytes[0] != 0xE9) {
+            if (it->wrote_size == 0 && it->partial_bytes == 0 && size > 0 && data_bytes[0] != ESP_IMAGE_HEADER_MAGIC) {
                 ESP_LOGE(TAG, "OTA image has invalid magic byte (expected 0xE9, saw 0x%02x", data_bytes[0]);
                 return ESP_ERR_OTA_VALIDATE_FAILED;
             }