[esp32_improv] Use stack buffer for URL formatting to avoid heap allocation

This commit is contained in:
J. Nick Koston
2025-12-27 11:27:28 -10:00
parent 1aebe90ad5
commit b9d80a5ef3

View File

@@ -405,7 +405,7 @@ void ESP32ImprovComponent::check_wifi_connection_() {
if (ip.is_ip4()) {
// "http://" (7) + IPv4 max (15) + ":" (1) + port max (5) + null = 29
char url_buffer[32];
memcpy(url_buffer, "http://", 7); // NOLINT - str_to null-terminates
memcpy(url_buffer, "http://", 7); // NOLINT(bugprone-not-null-terminated-result) - str_to null-terminates
ip.str_to(url_buffer + 7);
size_t len = strlen(url_buffer);
snprintf(url_buffer + len, sizeof(url_buffer) - len, ":%d", USE_WEBSERVER_PORT);