Unverified Commit 99e2fdd6 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!10915 usb: gadget: configfs: Prevent OOB read/write in usb_string_copy()

parents c75f8130 23cbbbdf
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -114,9 +114,12 @@ static int usb_string_copy(const char *s, char **s_copy)
	int ret;
	char *str;
	char *copy = *s_copy;

	ret = strlen(s);
	if (ret > 126)
		return -EOVERFLOW;
	if (ret < 1)
		return -EINVAL;

	str = kstrdup(s, GFP_KERNEL);
	if (!str)