1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-29 16:42:19 +01:00
This commit is contained in:
J. Nick Koston
2025-09-26 23:54:21 -05:00
parent dba680a748
commit c789fbf9f3

View File

@@ -341,7 +341,9 @@ void ESPHomeOTAComponent::handle_data_() {
while (total < ota_size) {
// TODO: timeout check
size_t requested = std::min(sizeof(buf), ota_size - total);
size_t remaining = ota_size - total;
const size_t buf_size = sizeof(buf);
size_t requested = remaining < buf_size ? remaining : buf_size;
ssize_t read = this->client_->read(buf, requested);
if (read == -1) {
if (this->would_block_(errno)) {