Add check for ports to avoid Segmentation fault

(cherry picked from commit fc596b2223d1d85c99945f5e05c1776fe703229f)
This commit is contained in:
lingsheng 2021-01-27 16:25:25 +08:00 committed by openeuler-sync-bot
parent 19d0be512e
commit 44bd2fb04c
2 changed files with 42 additions and 1 deletions

View File

@ -0,0 +1,37 @@
From d7bd15792ea3d2613aa5a0b09d948dc2ef77dfcf Mon Sep 17 00:00:00 2001
From: lingsheng <lingsheng@huawei.com>
Date: Wed, 27 Jan 2021 15:00:32 +0800
Subject: [PATCH] Add check for ports to avoid Segmentation fault
---
tools/umax_pp.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/tools/umax_pp.c b/tools/umax_pp.c
index 7b127e3..00ffea9 100644
--- a/tools/umax_pp.c
+++ b/tools/umax_pp.c
@@ -355,12 +355,15 @@ main (int argc, char **argv)
if (rc != 1)
{
ports = sanei_parport_find_port ();
- i = 0;
- rc = 0;
- while ((ports[i] != NULL) && (rc != 1))
+ if (ports != NULL)
{
- rc = sanei_umax_pp_initPort (strtol (ports[i], NULL, 16), NULL);
- i++;
+ i = 0;
+ rc = 0;
+ while ((ports[i] != NULL) && (rc != 1))
+ {
+ rc = sanei_umax_pp_initPort (strtol (ports[i], NULL, 16), NULL);
+ i++;
+ }
}
}
if (rc != 1)
--
2.23.0

View File

@ -3,7 +3,7 @@
Name: sane-backends Name: sane-backends
Version: 1.0.28 Version: 1.0.28
Release: 8 Release: 9
Summary: Scanner access software Summary: Scanner access software
License: GPLv2+ and GPLv2+ with exceptions and Public Domain and IJG and LGPLv2+ and MIT License: GPLv2+ and GPLv2+ with exceptions and Public Domain and IJG and LGPLv2+ and MIT
URL: http://www.sane-project.org URL: http://www.sane-project.org
@ -23,6 +23,7 @@ Patch0001: sane-xerox-mfp-blacklist-C460-for-JPEG.patch
Patch0002: sane-genesys-vector-glibcxxassert.patch Patch0002: sane-genesys-vector-glibcxxassert.patch
Patch0003: CVE-2020-12861-CVE-2020-12866-CVE-2020-12864.patch Patch0003: CVE-2020-12861-CVE-2020-12866-CVE-2020-12864.patch
Patch0004: CVE-2020-12867.patch Patch0004: CVE-2020-12867.patch
Patch0005: Add-check-for-ports-to-avoid-Segmentation-fault.patch
%description %description
SANE (Scanner Access Now Easy) is a sane and simple interface to both local and networked scanners SANE (Scanner Access Now Easy) is a sane and simple interface to both local and networked scanners
@ -205,6 +206,9 @@ exit 0
%{_unitdir}/* %{_unitdir}/*
%changelog %changelog
* Wed Jan 27 2021 lingsheng <lingsheng@huawei.com> - 1.0.28-9
- Add check for ports to avoid Segmentation fault
* Mon Jan 18 2021 zhanghua <zhanghua40@huawei.com> - 1.0.28-8 * Mon Jan 18 2021 zhanghua <zhanghua40@huawei.com> - 1.0.28-8
- fix CVE-2020-12867 - fix CVE-2020-12867