Unverified Commit 3d2431cb authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

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

parents b64d0f05 e7512460
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -104,9 +104,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 > USB_MAX_STRING_LEN)
		return -EOVERFLOW;
	if (ret < 1)
		return -EINVAL;

	if (copy) {
		str = copy;