usb: gadget: configfs: Replace strncpy with strlcpy

Use safer version of strcpy i.e. strlcpy instead of
strncpy for NULL terminated strings.

Change-Id: I5e2800d1d539545744a1b1231e1d589a7c92797a
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
This commit is contained in:
Manu Gautam 2017-03-28 11:28:24 +05:30 committed by Gerrit - the friendly Code Review server
parent ce87c90172
commit 851175d661

View file

@ -160,7 +160,7 @@ static int usb_string_copy(const char *s, char **s_copy)
if (!str)
return -ENOMEM;
}
strncpy(str, s, MAX_USB_STRING_WITH_NULL_LEN);
strlcpy(str, s, MAX_USB_STRING_WITH_NULL_LEN);
if (str[ret - 1] == '\n')
str[ret - 1] = '\0';
*s_copy = str;