Update esphome/components/api/proto.h

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
J. Nick Koston
2026-02-03 12:30:05 +01:00
committed by GitHub
parent 79832e60d0
commit 77428b79c0

View File

@@ -408,7 +408,11 @@ class DumpBuffer {
size_t pos() const { return pos_; }
/// Update position after buf_append_printf call
void set_pos(size_t pos) {
pos_ = pos;
if (pos >= CAPACITY) {
pos_ = CAPACITY - 1;
} else {
pos_ = pos;
}
buf_[pos_] = '\0';
}