fix set hostname

This commit is contained in:
MicroDev 2023-07-09 21:25:37 +05:30 committed by GitHub
parent 95535a8cd0
commit 8704ba158b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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);
}