From fa8dd9f24cffca4c93147c0267f528b1f8b2b539 Mon Sep 17 00:00:00 2001 From: Zhiqiang Liu Date: Thu, 29 Oct 2020 21:44:05 +0800 Subject: [PATCH 1/3] usbutils: backport one patch to init string buffer before reading from it backport one patch to init string buffer before reading from it Signed-off-by: Zhiqiang Liu Signed-off-by: Wenchao Hao --- ...ze-string-buffer-before-reading-from.patch | 37 +++++++++++++++++++ usbutils.spec | 7 +++- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 0001-usbmisc-initialize-string-buffer-before-reading-from.patch diff --git a/0001-usbmisc-initialize-string-buffer-before-reading-from.patch b/0001-usbmisc-initialize-string-buffer-before-reading-from.patch new file mode 100644 index 0000000..ef8ffc6 --- /dev/null +++ b/0001-usbmisc-initialize-string-buffer-before-reading-from.patch @@ -0,0 +1,37 @@ +From e3a98cd4870e46cefbfaa1c6f3142c70351aba02 Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman +Date: Thu, 22 Oct 2020 12:01:44 +0200 +Subject: [PATCH 11/15] usbmisc: initialize string buffer before reading from + device. + +Cliff Biffle points out that some devices lie about the length of their +string, so we end up with stack data in the string buffer, which is then +displayed by userspace. Fix this up by initializing the data to 0 first +before reading from the device. + +Reported-by: Cliff L. Biffle +Signed-off-by: Greg Kroah-Hartman +--- + usbmisc.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/usbmisc.c b/usbmisc.c +index 9a329f2..ba0591f 100644 +--- a/usbmisc.c ++++ b/usbmisc.c +@@ -210,6 +210,12 @@ char *get_dev_string(libusb_device_handle *dev, uint8_t id) + langid = get_any_langid(dev); + if (!langid) return strdup("(error)"); + ++ /* ++ * Some devices lie about their string size, so initialize ++ * the buffer with all 0 to account for that. ++ */ ++ memset(unicode_buf, 0x00, sizeof(unicode_buf)); ++ + ret = libusb_get_string_descriptor(dev, id, langid, + (unsigned char *) unicode_buf, + sizeof unicode_buf); +-- +1.8.3.1 + diff --git a/usbutils.spec b/usbutils.spec index 5aa7e43..8127b4d 100644 --- a/usbutils.spec +++ b/usbutils.spec @@ -1,6 +1,6 @@ Name: usbutils Version: 012 -Release: 2 +Release: 3 Summary: Linux utilities for USB device License: GPLv2+ URL: http://www.linux-usb.org/ @@ -10,6 +10,8 @@ Source1: GPL-2.0.txt Source2: GPL-3.0.txt BuildRequires: libusbx-devel systemd-devel git gcc libtool +Patch1: 0001-usbmisc-initialize-string-buffer-before-reading-from.patch + Requires: hwdata %description @@ -45,6 +47,9 @@ install -D -m 644 %{SOURCE2} %{buildroot}%{_defaultlicensedir}/%{name}/GPL-3.0.t %{_mandir}/*/* %changelog +* Thu Oct 29 2020 Zhiqiang Liu - 012-3 +- backport one patch to init string buffer before reading from it + * Tue Sep 28 2021 Wenchao Hao - 012-2 - Remove unused patches file -- Gitee From 510cd8252869130a2a9ec6a375bb79a50e25185a Mon Sep 17 00:00:00 2001 From: chenyanpanHW Date: Fri, 30 Jul 2021 23:39:43 +0800 Subject: [PATCH 2/3] delete -S git from %autosetup, and delete BuildRequires git --- usbutils.spec | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/usbutils.spec b/usbutils.spec index 8127b4d..2c7af41 100644 --- a/usbutils.spec +++ b/usbutils.spec @@ -1,6 +1,6 @@ Name: usbutils Version: 012 -Release: 3 +Release: 4 Summary: Linux utilities for USB device License: GPLv2+ URL: http://www.linux-usb.org/ @@ -9,7 +9,7 @@ Source0: https://www.kernel.org/pub/linux/utils/usb/usbutils/%{name}-%{version}. Source1: GPL-2.0.txt Source2: GPL-3.0.txt -BuildRequires: libusbx-devel systemd-devel git gcc libtool +BuildRequires: libusbx-devel systemd-devel gcc libtool Patch1: 0001-usbmisc-initialize-string-buffer-before-reading-from.patch Requires: hwdata @@ -26,7 +26,7 @@ This contains man files for the using of usbutils. %prep -%autosetup -n %{name}-%{version} -p1 -S git +%autosetup -n %{name}-%{version} -p1 %build autoreconf --install --symlink @@ -47,6 +47,9 @@ install -D -m 644 %{SOURCE2} %{buildroot}%{_defaultlicensedir}/%{name}/GPL-3.0.t %{_mandir}/*/* %changelog +* Fri Jul 30 2021 chenyanpanHW - 012-4 +- DESC: delete -S git from %autosetup, and delete BuildRequires git + * Thu Oct 29 2020 Zhiqiang Liu - 012-3 - backport one patch to init string buffer before reading from it -- Gitee From 630cd12cd8fc3046406084933a0a70de4ebee3b8 Mon Sep 17 00:00:00 2001 From: Wenchao Hao Date: Tue, 28 Sep 2021 14:51:28 +0800 Subject: [PATCH 3/3] Nothing but to sync master and LTS branch Signed-off-by: Wenchao Hao --- usbutils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/usbutils.spec b/usbutils.spec index 2c7af41..ba6f507 100644 --- a/usbutils.spec +++ b/usbutils.spec @@ -1,6 +1,6 @@ Name: usbutils Version: 012 -Release: 4 +Release: 5 Summary: Linux utilities for USB device License: GPLv2+ URL: http://www.linux-usb.org/ @@ -47,6 +47,9 @@ install -D -m 644 %{SOURCE2} %{buildroot}%{_defaultlicensedir}/%{name}/GPL-3.0.t %{_mandir}/*/* %changelog +* Tue Sep 28 2021 Wenchao Hao - 012-5 +- Nothing but to sync master and LTS branch + * Fri Jul 30 2021 chenyanpanHW - 012-4 - DESC: delete -S git from %autosetup, and delete BuildRequires git -- Gitee