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:
parent
ce87c90172
commit
851175d661
1 changed files with 1 additions and 1 deletions
|
@ -160,7 +160,7 @@ static int usb_string_copy(const char *s, char **s_copy)
|
||||||
if (!str)
|
if (!str)
|
||||||
return -ENOMEM;
|
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')
|
if (str[ret - 1] == '\n')
|
||||||
str[ret - 1] = '\0';
|
str[ret - 1] = '\0';
|
||||||
*s_copy = str;
|
*s_copy = str;
|
||||||
|
|
Loading…
Add table
Reference in a new issue