mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-30 02:37:31 +02:00
fix(mdns): Allow setting instance name only after hostname set
Closes https://github.com/espressif/esp-protocols/issues/190
This commit is contained in:
@ -5398,7 +5398,7 @@ esp_err_t mdns_instance_name_set(const char *instance)
|
||||
if (!_mdns_server) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
if (_str_null_or_empty(instance) || strlen(instance) > (MDNS_NAME_BUF_LEN - 1)) {
|
||||
if (_str_null_or_empty(instance) || _mdns_server->hostname == NULL || strlen(instance) > (MDNS_NAME_BUF_LEN - 1)) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
char *new_instance = strndup(instance, MDNS_NAME_BUF_LEN - 1);
|
||||
|
Reference in New Issue
Block a user