[U-Boot] [PATCH 5/8] USB-CDC: Replace 'strcpy' by 'strlcpy'

Vitaly Kuzmichev vkuzmichev at mvista.com
Thu Aug 12 14:44:43 CEST 2010


Replace 'strcpy' by more safe 'strlcpy' that is implemented in ether.c

Signed-off-by: Vitaly Kuzmichev <vkuzmichev at mvista.com>
---
 drivers/usb/gadget/ether.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index dd3ab8c..25d6243 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -1600,12 +1600,12 @@ static int eth_bind(struct usb_gadget *gadget)
 	if (bcdDevice)
 		device_desc.bcdDevice = cpu_to_le16(bcdDevice);
 	if (iManufacturer)
-		strcpy (manufacturer, iManufacturer);
+		strlcpy (manufacturer, iManufacturer, sizeof manufacturer);
 	if (iProduct)
-		strcpy (product_desc, iProduct);
+		strlcpy (product_desc, iProduct, sizeof product_desc);
 	if (iSerialNumber) {
 		device_desc.iSerialNumber = STRING_SERIALNUMBER,
-		strcpy(serial_number, iSerialNumber);
+		strlcpy(serial_number, iSerialNumber, sizeof serial_number);
 	}
 
 	/* all we really need is bulk IN/OUT */
-- 
1.7.1.1



More information about the U-Boot mailing list