mirror of
https://github.com/esphome/esphome.git
synced 2026-09-20 19:48:39 +00:00
Update esphome/components/mqtt/mqtt_component.cpp
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
co-authored by
Copilot
parent
2182d1e9f0
commit
d27d6d64da
@@ -232,7 +232,7 @@ bool MQTTComponent::send_discovery_() {
|
||||
#else
|
||||
const char *fmt = ver_fmt;
|
||||
#endif
|
||||
// sizeof(ver_fmt) + 8: format specifier expands to 8 hex digits, plus safety margin
|
||||
// Buffer sized for format string expansion: ~4 bytes net growth from format specifier to 8 hex digits, plus safety margin
|
||||
char version_buf[sizeof(ver_fmt) + 8];
|
||||
snprintf(version_buf, sizeof(version_buf), fmt, App.get_config_hash());
|
||||
device_info[MQTT_DEVICE_SW_VERSION] = version_buf;
|
||||
|
||||
Reference in New Issue
Block a user