From 78204499bc94b2da1477fbed282de07b17a7b35e Mon Sep 17 00:00:00 2001 From: Markeryang <747675909@qq.com> Date: Fri, 17 Jul 2020 15:56:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=200005-sg?= =?UTF-8?q?=5Finq-fix-potential-unbounded-loop-in-export.patch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...x-potential-unbounded-loop-in-export.patch | 62 ------------------- 1 file changed, 62 deletions(-) delete mode 100644 0005-sg_inq-fix-potential-unbounded-loop-in-export.patch diff --git a/0005-sg_inq-fix-potential-unbounded-loop-in-export.patch b/0005-sg_inq-fix-potential-unbounded-loop-in-export.patch deleted file mode 100644 index 70b1505..0000000 --- a/0005-sg_inq-fix-potential-unbounded-loop-in-export.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 96055f3a30d9643eff5141ed1926468301379c74 Mon Sep 17 00:00:00 2001 -From: Douglas Gilbert -Date: Fri, 8 Apr 2016 02:46:35 +0000 -Subject: [PATCH 016/126] sg_inq: fix potential unbounded loop in --export - -git-svn-id: svn://localhost/trunk@691 6180dd3e-e324-4e3e-922d-17de1ae2f315 ---- - src/sg_inq.c | 21 +++++++++++---------- - 1 files changed, 11 insertions(+), 10 deletions(-) - -diff --git a/src/sg_inq.c b/src/sg_inq.c -index 9dc8838..8aa1970 100644 ---- a/src/sg_inq.c -+++ b/src/sg_inq.c -@@ -43,7 +43,7 @@ - #include "sg_unaligned.h" - #include "sg_pr2serr.h" - --static const char * version_str = "1.57 20160208"; /* SPC-5 rev 08 */ -+static const char * version_str = "1.58 20160407"; /* SPC-5 rev 08 */ - - /* INQUIRY notes: - * It is recommended that the initial allocation length given to a -@@ -1032,17 +1032,18 @@ static int - encode_whitespaces(unsigned char *str, int inlen) - { - int k, res; -- int j = 0; -- int valid = 0; -+ int j; -+ bool valid = false; - int outlen = inlen, zeroes = 0; - - /* Skip initial whitespaces */ -- while (isblank(str[j])) -- j++; -- /* Skip possible unicode prefix characters */ -- while (str[j] < 0x20) -- j++; -- -+ for (j = 0; (j < inlen) && isblank(str[j]); ++j) -+ ; -+ if (j < inlen) { -+ /* Skip possible unicode prefix characters */ -+ for ( ; (j < inlen) && (str[j] < 0x20); ++j) -+ ; -+ } - k = j; - /* Strip trailing whitespaces */ - while ((outlen > k) && -@@ -1069,7 +1070,7 @@ encode_whitespaces(unsigned char *str, int inlen) - zeroes = 0; - } else { - str[res++] = str[k]; -- valid++; -+ valid = true; - zeroes = 0; - } - } --- -1.8.3.1 -