fix set hostname

This commit is contained in:
MicroDev 2023-07-09 21:25:37 +05:30 committed by Dan Halbert
parent 98bd9e50d9
commit b6d4488b31

View File

@ -88,7 +88,7 @@ mp_obj_t common_hal_wifi_radio_get_hostname(wifi_radio_obj_t *self) {
void common_hal_wifi_radio_set_hostname(wifi_radio_obj_t *self, const char *hostname) {
assert(strlen(hostname) < MP_ARRAY_SIZE(self->hostname));
memcpy(self->hostname, hostname, strlen(hostname));
strncpy(self->hostname, hostname, MP_ARRAY_SIZE(self->hostname) - 1);
netif_set_hostname(NETIF_STA, self->hostname);
netif_set_hostname(NETIF_AP, self->hostname);
}