[GH-ISSUE #1348] WiFiManager should make defensive copy of hostname #1153

Closed
opened 2026-02-28 01:28:46 +03:00 by kerem · 2 comments
Owner

Originally created by @lptr on GitHub (Jan 26, 2022).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1348

Basic Infos

Hardware

WiFimanager Branch/Release: 2.0.5-beta
Hardware: ESP32

Description

WiFiManager::setHostname(char*) should make a defensive copy of parameter value instead of storing the raw parameter value. Currently it is possible to e.g. pass a hostname value that gets freed up before WiFi.setHostname() etc., resulting in a corrupted hostname being set.

Note: setCustomHeadElement(char*) probably suffers from the same problem.

Originally created by @lptr on GitHub (Jan 26, 2022). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1348 ### Basic Infos #### Hardware WiFimanager Branch/Release: 2.0.5-beta Hardware: ESP32 ### Description `WiFiManager::setHostname(char*)` should make a defensive copy of parameter value instead of storing the raw parameter value. Currently it is possible to e.g. pass a `hostname` value that gets freed up before `WiFi.setHostname()` etc., resulting in a corrupted hostname being set. Note: `setCustomHeadElement(char*)` probably suffers from the same problem.
kerem 2026-02-28 01:28:46 +03:00
Author
Owner

@tablatronix commented on GitHub (Feb 2, 2022):

YES, I forgot all about this, but saw that a couple weeks ago.

Doesn't esp sethostname take something stange?

<!-- gh-comment-id:1027532599 --> @tablatronix commented on GitHub (Feb 2, 2022): YES, I forgot all about this, but saw that a couple weeks ago. Doesn't esp sethostname take something stange?
Author
Owner

@tablatronix commented on GitHub (Feb 5, 2022):

No idea what works best here, ideas? I just changed it to string , it should copy and it seems to work now

<!-- gh-comment-id:1030517706 --> @tablatronix commented on GitHub (Feb 5, 2022): No idea what works best here, ideas? I just changed it to string , it should copy and it seems to work now
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#1153
No description provided.