From 79e567a3f1f882fad802eaa47949a3dd4c416e40 Mon Sep 17 00:00:00 2001 From: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com> Date: Mon, 23 Feb 2026 15:30:02 -0500 Subject: [PATCH] Fix --- esphome/core/application.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/esphome/core/application.h b/esphome/core/application.h index 56fa690cbe..ee5ec559f4 100644 --- a/esphome/core/application.h +++ b/esphome/core/application.h @@ -276,11 +276,15 @@ class Application { /// Maximum size of the comment buffer (including null terminator) static constexpr size_t COMMENT_MAX_SIZE = 256; - /// Get the comment string (PROGMEM-safe, copies to buffer) + /// Copy the comment string into the provided buffer void get_comment_string(std::span buffer); /// Get the comment of this Application as a string - std::string get_comment(); + std::string get_comment() { + char buffer[COMMENT_MAX_SIZE]; + this->get_comment_string(buffer); + return std::string(buffer); + } bool is_name_add_mac_suffix_enabled() const { return this->name_add_mac_suffix_; } @@ -296,13 +300,18 @@ class Application { /// Get the build time as a Unix timestamp time_t get_build_time(); - /// Get the build time string (PROGMEM-safe, copies to buffer) + /// Copy the build time string into the provided buffer + /// Buffer must be BUILD_TIME_STR_SIZE bytes (compile-time enforced) void get_build_time_string(std::span buffer); /// Get the build time as a string (deprecated, use get_build_time_string() instead) // Remove before 2026.7.0 ESPDEPRECATED("Use get_build_time_string() instead. Removed in 2026.7.0", "2026.1.0") - std::string get_compilation_time(); + std::string get_compilation_time() { + char buf[BUILD_TIME_STR_SIZE]; + this->get_build_time_string(buf); + return std::string(buf); + } /// Get the cached time in milliseconds from when the current component started its loop execution inline uint32_t IRAM_ATTR HOT get_loop_component_start_time() const { return this->loop_component_start_time_; }