diff --git a/class/cdc/usbh_cdc_ecm.c b/class/cdc/usbh_cdc_ecm.c index e5ee046b..a388ad4a 100644 --- a/class/cdc/usbh_cdc_ecm.c +++ b/class/cdc/usbh_cdc_ecm.c @@ -188,7 +188,7 @@ get_mac: } USB_LOG_INFO("Set CDC ECM packet filter:%04x\r\n", CONFIG_USBHOST_CDC_ECM_PKT_FILTER); - memcpy(hport->config.intf[intf].devname, DEV_FORMAT, CONFIG_USBHOST_DEV_NAMELEN); + strncpy(hport->config.intf[intf].devname, DEV_FORMAT, CONFIG_USBHOST_DEV_NAMELEN); USB_LOG_INFO("Register CDC ECM Class:%s\r\n", hport->config.intf[intf].devname); diff --git a/class/cdc/usbh_cdc_ncm.c b/class/cdc/usbh_cdc_ncm.c index 1162bb38..24800126 100644 --- a/class/cdc/usbh_cdc_ncm.c +++ b/class/cdc/usbh_cdc_ncm.c @@ -206,7 +206,7 @@ get_mac: } } - memcpy(hport->config.intf[intf].devname, DEV_FORMAT, CONFIG_USBHOST_DEV_NAMELEN); + strncpy(hport->config.intf[intf].devname, DEV_FORMAT, CONFIG_USBHOST_DEV_NAMELEN); USB_LOG_INFO("Register CDC NCM Class:%s\r\n", hport->config.intf[intf].devname); diff --git a/class/vendor/net/usbh_asix.c b/class/vendor/net/usbh_asix.c index b7010153..9e7888a7 100644 --- a/class/vendor/net/usbh_asix.c +++ b/class/vendor/net/usbh_asix.c @@ -597,7 +597,7 @@ static int usbh_asix_connect(struct usbh_hubport *hport, uint8_t intf) USB_LOG_INFO("Init %s done\r\n", asix_class->name); - memcpy(hport->config.intf[intf].devname, DEV_FORMAT, CONFIG_USBHOST_DEV_NAMELEN); + strncpy(hport->config.intf[intf].devname, DEV_FORMAT, CONFIG_USBHOST_DEV_NAMELEN); USB_LOG_INFO("Register ASIX Class:%s\r\n", hport->config.intf[intf].devname); usbh_asix_run(asix_class); diff --git a/class/vendor/net/usbh_rtl8152.c b/class/vendor/net/usbh_rtl8152.c index 2cdadcc3..25d3e9a2 100644 --- a/class/vendor/net/usbh_rtl8152.c +++ b/class/vendor/net/usbh_rtl8152.c @@ -2080,7 +2080,7 @@ static int usbh_rtl8152_connect(struct usbh_hubport *hport, uint8_t intf) } } - memcpy(hport->config.intf[intf].devname, DEV_FORMAT, CONFIG_USBHOST_DEV_NAMELEN); + strncpy(hport->config.intf[intf].devname, DEV_FORMAT, CONFIG_USBHOST_DEV_NAMELEN); USB_LOG_INFO("Register RTL8152 Class:%s\r\n", hport->config.intf[intf].devname); diff --git a/class/wireless/usbh_bluetooth.c b/class/wireless/usbh_bluetooth.c index 4c223dbf..02da7adb 100644 --- a/class/wireless/usbh_bluetooth.c +++ b/class/wireless/usbh_bluetooth.c @@ -96,7 +96,7 @@ static int usbh_bluetooth_connect(struct usbh_hubport *hport, uint8_t intf) } USB_LOG_INFO("Bluetooth select altsetting 0\r\n"); #endif - snprintf(hport->config.intf[intf].devname, CONFIG_USBHOST_DEV_NAMELEN, DEV_FORMAT); + strncpy(hport->config.intf[intf].devname, DEV_FORMAT, CONFIG_USBHOST_DEV_NAMELEN); USB_LOG_INFO("Register Bluetooth Class:%s\r\n", hport->config.intf[intf].devname); usbh_bluetooth_run(bluetooth_class); return ret; diff --git a/class/wireless/usbh_rndis.c b/class/wireless/usbh_rndis.c index fc93be8a..bdf3461c 100644 --- a/class/wireless/usbh_rndis.c +++ b/class/wireless/usbh_rndis.c @@ -387,7 +387,7 @@ static int usbh_rndis_connect(struct usbh_hubport *hport, uint8_t intf) rndis_class->mac[4], rndis_class->mac[5]); - memcpy(hport->config.intf[intf].devname, DEV_FORMAT, CONFIG_USBHOST_DEV_NAMELEN); + strncpy(hport->config.intf[intf].devname, DEV_FORMAT, CONFIG_USBHOST_DEV_NAMELEN); USB_LOG_INFO("Register RNDIS Class:%s\r\n", hport->config.intf[intf].devname); usbh_rndis_run(rndis_class);