Skip to content

Commit f902e0d

Browse files
authored
Merge pull request #8201 from dhalbert/8.2.x-backport-8150-set-hostname
8.2.x backport: fix set hostname
2 parents 99347ae + b6d4488 commit f902e0d

File tree

1 file changed

+1
-1
lines changed
  • ports/raspberrypi/common-hal/wifi

1 file changed

+1
-1
lines changed

ports/raspberrypi/common-hal/wifi/Radio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ mp_obj_t common_hal_wifi_radio_get_hostname(wifi_radio_obj_t *self) {
8888

8989
void common_hal_wifi_radio_set_hostname(wifi_radio_obj_t *self, const char *hostname) {
9090
assert(strlen(hostname) < MP_ARRAY_SIZE(self->hostname));
91-
memcpy(self->hostname, hostname, strlen(hostname));
91+
strncpy(self->hostname, hostname, MP_ARRAY_SIZE(self->hostname) - 1);
9292
netif_set_hostname(NETIF_STA, self->hostname);
9393
netif_set_hostname(NETIF_AP, self->hostname);
9494
}

0 commit comments

Comments
 (0)