fix(mdns): add terminator for the getting host name
This commit is contained in:
parent
418791cf79
commit
b6a4d94ab0
1 changed files with 3 additions and 1 deletions
|
|
@ -5607,7 +5607,9 @@ esp_err_t mdns_hostname_get(char *hostname)
|
|||
}
|
||||
|
||||
MDNS_SERVICE_LOCK();
|
||||
strncpy(hostname, _mdns_server->hostname, strnlen(_mdns_server->hostname, MDNS_NAME_BUF_LEN));
|
||||
size_t len = strnlen(_mdns_server->hostname, MDNS_NAME_BUF_LEN - 1);
|
||||
strncpy(hostname, _mdns_server->hostname, len);
|
||||
hostname[len] = 0;
|
||||
MDNS_SERVICE_UNLOCK();
|
||||
return ESP_OK;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue