Skip to content

Commit 331375a

Browse files
committed
feat(zigbee): Add conditions to reject OTA upgrade
1 parent d62851d commit 331375a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

libraries/Zigbee/src/ZigbeeHandlers.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,15 @@ static esp_err_t zb_ota_upgrade_query_image_resp_handler(const esp_zb_zcl_ota_up
301301
log_i("Zigbee - Queried OTA image from address: 0x%04hx, endpoint: %d", message->server_addr.u.short_addr, message->server_endpoint);
302302
log_i("Zigbee - Image version: 0x%lx, manufacturer code: 0x%x, image size: %ld", message->file_version, message->manufacturer_code,
303303
message->image_size);
304+
//TODO: add more contidions to reject OTA image upgrade
305+
if(message->image_size == 0) {
306+
log_i("Zigbee - Rejecting OTA image upgrade, image size is 0");
307+
return ESP_FAIL;
308+
}
309+
if(message->file_version == 0) {
310+
log_i("Zigbee - Rejecting OTA image upgrade, file version is 0");
311+
return ESP_FAIL;
312+
}
304313
log_i("Zigbee - Approving OTA image upgrade");
305314
} else {
306315
log_i("Zigbee - OTA image upgrade response status: 0x%x", message->info.status);

0 commit comments

Comments
 (0)