diff --git a/esphome/components/ethernet/ethernet_component.h b/esphome/components/ethernet/ethernet_component.h index de136a02eb..4f30959e40 100644 --- a/esphome/components/ethernet/ethernet_component.h +++ b/esphome/components/ethernet/ethernet_component.h @@ -114,7 +114,12 @@ class EthernetComponent : public Component { /// @brief Set arbitratry PHY registers from config. void write_phy_register_(esp_eth_mac_t *mac, PHYRegister register_data); + private: + // Stores a pointer to a string literal (static storage duration). + // ONLY set from Python-generated code with string literals - never dynamic strings. const char *use_address_{""}; + + protected: #ifdef USE_ETHERNET_SPI uint8_t clk_pin_; uint8_t miso_pin_; diff --git a/esphome/components/openthread/openthread.h b/esphome/components/openthread/openthread.h index d099c321f9..3132e41696 100644 --- a/esphome/components/openthread/openthread.h +++ b/esphome/components/openthread/openthread.h @@ -41,6 +41,10 @@ class OpenThreadComponent : public Component { bool teardown_started_{false}; bool teardown_complete_{false}; std::function factory_reset_external_callback_; + + private: + // Stores a pointer to a string literal (static storage duration). + // ONLY set from Python-generated code with string literals - never dynamic strings. const char *use_address_{""}; }; diff --git a/esphome/components/wifi/wifi_component.h b/esphome/components/wifi/wifi_component.h index 0c079ef1e4..4aa2ad15d4 100644 --- a/esphome/components/wifi/wifi_component.h +++ b/esphome/components/wifi/wifi_component.h @@ -393,7 +393,12 @@ class WiFiComponent : public Component { void wifi_scan_done_callback_(); #endif + private: + // Stores a pointer to a string literal (static storage duration). + // ONLY set from Python-generated code with string literals - never dynamic strings. const char *use_address_{""}; + + protected: FixedVector sta_; std::vector sta_priorities_; wifi_scan_vector_t scan_result_;