lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220105040439.3182-1-jj251510319013@gmail.com>
Date:   Wed,  5 Jan 2022 12:04:39 +0800
From:   Wei Ming Chen <jj251510319013@...il.com>
To:     linux-kernel@...r.kernel.org
Cc:     linux-usb@...r.kernel.org, gregkh@...uxfoundation.org,
        balbi@...nel.org, maze@...gle.com,
        Wei Ming Chen <jj251510319013@...il.com>
Subject: [PATCH] usb: gadget: function: Fix returning incorrect PNP string

There will be 2 leading bytes indicating the total length of
the PNP string, so I think we should add value by 2, otherwise
the PNP string copied to user will not contain the last 2 bytes

Signed-off-by: Wei Ming Chen <jj251510319013@...il.com>
---
 drivers/usb/gadget/function/f_printer.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/f_printer.c b/drivers/usb/gadget/function/f_printer.c
index abec5c58f525..3fb00fd0b5ee 100644
--- a/drivers/usb/gadget/function/f_printer.c
+++ b/drivers/usb/gadget/function/f_printer.c
@@ -1005,9 +1005,11 @@ static int printer_func_setup(struct usb_function *f,
 				break;
 			}
 			value = strlen(dev->pnp_string);
+			memcpy(buf + 2, dev->pnp_string, value);
+
+			value += 2;
 			buf[0] = (value >> 8) & 0xFF;
 			buf[1] = value & 0xFF;
-			memcpy(buf + 2, dev->pnp_string, value);
 			DBG(dev, "1284 PNP String: %x %s\n", value,
 			    dev->pnp_string);
 			break;
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ