diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c index 45a484c..4ba7c1d 100644 --- a/drivers/usb/gadget/g_dnl.c +++ b/drivers/usb/gadget/g_dnl.c @@ -49,8 +49,7 @@ static const char manufacturer[] = CONFIG_G_DNL_MANUFACTURER; void g_dnl_set_serialnumber(char *s) { memset(g_dnl_serial, 0, MAX_STRING_SERIAL); - if (strlen(s) < MAX_STRING_SERIAL) - strncpy(g_dnl_serial, s, strlen(s)); + strncpy(g_dnl_serial, s, MAX_STRING_SERIAL - 1); } static struct usb_device_descriptor device_desc = {