mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-15 19:42:09 +02:00
Merge pull request #409 from zwx1995esp/fix/mdns_host_name_get
fix(mdns): add terminator for the getting host name
This commit is contained in:
@ -5613,7 +5613,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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user