From 167d48b6f3130aa3989ff799f98a6257f5ead35d Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Fri, 18 Aug 2017 11:05:10 +0200 Subject: [PATCH] New 2.5.1 release --- ...itch-don-t-return-a-value-from-stack.patch | 34 ------------------- ...sb_modeswitch-fix-a-wrong-comparison.patch | 26 ++++++++++++++ ...h-count-the-target-devices-from-zero.patch | 26 ++++++++++++++ sources | 2 +- usb_modeswitch.spec | 16 ++++++--- 5 files changed, 64 insertions(+), 40 deletions(-) delete mode 100644 0001-usb_modeswitch-don-t-return-a-value-from-stack.patch create mode 100644 0001-usb_modeswitch-fix-a-wrong-comparison.patch create mode 100644 0002-usb_modeswitch-count-the-target-devices-from-zero.patch diff --git a/0001-usb_modeswitch-don-t-return-a-value-from-stack.patch b/0001-usb_modeswitch-don-t-return-a-value-from-stack.patch deleted file mode 100644 index afe92a4..0000000 --- a/0001-usb_modeswitch-don-t-return-a-value-from-stack.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 93686f8ba8c1ed6bf559dbfda53f9c7d702c76b5 Mon Sep 17 00:00:00 2001 -From: Lubomir Rintel -Date: Thu, 21 Jul 2016 18:13:58 +0200 -Subject: [PATCH] usb_modeswitch: don't return a value from stack - -The memory is not allocated anymore when the function returns and that -causes no end of mayhem and undefined behavior. - -Let's make it static so that it's perserved after the return. It wastes -LINE_DIM bytes of memory and requires the caller to consume the value -before another call, but that's no problem. - -http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?f=2&t=2557 ---- - usb_modeswitch.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/usb_modeswitch.c b/usb_modeswitch.c -index f9c8b2e..3373ccf 100644 ---- a/usb_modeswitch.c -+++ b/usb_modeswitch.c -@@ -1855,7 +1855,8 @@ char* ReadParseParam(const char* FileName, char *VariableName) - char *FirstQuote, *LastQuote, *P1, *P2; - int Line=0; - unsigned Len=0, Pos=0; -- char Str[LINE_DIM], *token, *configPos; -+ static char Str[LINE_DIM]; -+ char *token, *configPos; - FILE *file = NULL; - - // Reading and storing input during the first call --- -2.7.4 - diff --git a/0001-usb_modeswitch-fix-a-wrong-comparison.patch b/0001-usb_modeswitch-fix-a-wrong-comparison.patch new file mode 100644 index 0000000..863e880 --- /dev/null +++ b/0001-usb_modeswitch-fix-a-wrong-comparison.patch @@ -0,0 +1,26 @@ +From bcb5b8702adbf568598988fccf256586b5788fcb Mon Sep 17 00:00:00 2001 +From: Lubomir Rintel +Date: Fri, 18 Aug 2017 10:37:15 +0200 +Subject: [PATCH 1/2] usb_modeswitch: fix a wrong comparison + +The char pointer should be dereferences when checking the string is empty. +--- + usb_modeswitch.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/usb_modeswitch.c b/usb_modeswitch.c +index b2b930b..6948a84 100644 +--- a/usb_modeswitch.c ++++ b/usb_modeswitch.c +@@ -1707,7 +1707,7 @@ struct libusb_device* search_devices( int *numFound, int vendor, char* productLi + *numFound = 0; + + /* Sanity check */ +- if (!vendor || productList == '\0') ++ if (!vendor || *productList == '\0') + return NULL; + + listcopy = malloc(strlen(productList)+1); +-- +2.13.0 + diff --git a/0002-usb_modeswitch-count-the-target-devices-from-zero.patch b/0002-usb_modeswitch-count-the-target-devices-from-zero.patch new file mode 100644 index 0000000..144d93d --- /dev/null +++ b/0002-usb_modeswitch-count-the-target-devices-from-zero.patch @@ -0,0 +1,26 @@ +From 9d05fe0e0f6b049520d97a47d042d5cfad35b5d6 Mon Sep 17 00:00:00 2001 +From: Lubomir Rintel +Date: Fri, 18 Aug 2017 10:40:41 +0200 +Subject: [PATCH 2/2] usb_modeswitch: count the target devices from zero + +Most likely a typo here. +--- + usb_modeswitch.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/usb_modeswitch.c b/usb_modeswitch.c +index 6948a84..4a1fb5c 100644 +--- a/usb_modeswitch.c ++++ b/usb_modeswitch.c +@@ -1579,7 +1579,7 @@ int checkSuccess() + * Target device on the same bus with higher device number is returned, + * description is read for syslog message + */ +- for (i=i; i < CheckSuccess; i++) { ++ for (i=0; i < CheckSuccess; i++) { + SHOW_PROGRESS(output," Search for target devices ...\n"); + dev = search_devices(&newTargetCount, TargetVendor, TargetProductList, + TargetClass, 0, SEARCH_TARGET); +-- +2.13.0 + diff --git a/sources b/sources index 1083d19..33497be 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -6e1640db47768bb9012f91b7593116ef usb-modeswitch-2.4.0.tar.bz2 +SHA512 (usb-modeswitch-2.5.1.tar.bz2) = 23f1866cbb5882280369362f6d3e01d991136f322284d3f343da132520569f9e303cd9c4368a71893a3d959bae6bde2d4325f6dc175a1cb2d4dd5faa61add6ab diff --git a/usb_modeswitch.spec b/usb_modeswitch.spec index 4f8d172..f782d8d 100644 --- a/usb_modeswitch.spec +++ b/usb_modeswitch.spec @@ -1,8 +1,8 @@ %define source_name usb-modeswitch Name: usb_modeswitch -Version: 2.4.0 -Release: 8%{?dist} +Version: 2.5.1 +Release: 1%{?dist} Summary: USB Modeswitch gets mobile broadband cards in operational mode Summary(de): USB Modeswitch aktiviert UMTS-Karten Group: Applications/System @@ -18,8 +18,10 @@ Patch0: rhbz948451-fix-manual-pages.patch Patch1: device_reference-utf8.patch # http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?f=2&t=2556 Patch2: 0001-Fix-crash-on-early-fail.patch -# http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?f=2&t=2557 -Patch3: 0001-usb_modeswitch-don-t-return-a-value-from-stack.patch +# http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?f=2&t=2732 +Patch3: 0001-usb_modeswitch-fix-a-wrong-comparison.patch +# http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?f=2&t=2733 +Patch4: 0002-usb_modeswitch-count-the-target-devices-from-zero.patch BuildRequires: libusbx-devel BuildRequires: jimtcl-devel @@ -48,7 +50,8 @@ cp -f %{SOURCE1} device_reference.txt %patch0 -p1 -b .manpage %patch1 -p0 -b .utf8 %patch2 -p1 -b .libusb_exit -%patch3 -p1 -b .stack +%patch3 -p1 -b .char_deref +%patch4 -p1 -b .zero_iter %build @@ -75,6 +78,9 @@ make install \ %changelog +* Fri Aug 18 2017 Lubomir Rintel - 2.5.1-1 +- New 2.5.1 release + * Thu Aug 03 2017 Fedora Release Engineering - 2.4.0-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild