From e69013317d8c6f64e1d7bb5677e353d68730272c Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 11 Oct 2025 15:33:46 -1000 Subject: [PATCH] Update esphome/core/helpers.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- esphome/core/helpers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/core/helpers.cpp b/esphome/core/helpers.cpp index 2d8122699b..fb8b220b2f 100644 --- a/esphome/core/helpers.cpp +++ b/esphome/core/helpers.cpp @@ -247,7 +247,7 @@ std::string make_name_with_suffix(const std::string &name, char sep, const char if (total_len >= MAX_NAME_WITH_SUFFIX_SIZE) { // NOTE: This calculation could underflow if suffix_len >= MAX_NAME_WITH_SUFFIX_SIZE - 2, // but this is safe because this helper is only called with small suffixes: - // MAC suffixes (6-12 bytes), ".local" (6 bytes), etc. + // MAC suffixes (6-12 bytes), ".local" (5 bytes), etc. name_len = MAX_NAME_WITH_SUFFIX_SIZE - suffix_len - 2; // -2 for separator and null terminator total_len = name_len + 1 + suffix_len; }