!14 [sync] PR-13: Add check for ports to avoid Segmentation fault

From: @openeuler-sync-bot
Reviewed-by: @small_leek
Signed-off-by: @small_leek
This commit is contained in:
openeuler-ci-bot 2021-01-28 10:23:00 +08:00 committed by Gitee
commit 1843afbf1b
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
Version: 1.0.28
Release: 8
Release: 9
Summary: Scanner access software
License: GPLv2+ and GPLv2+ with exceptions and Public Domain and IJG and LGPLv2+ and MIT
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
Patch0003: CVE-2020-12861-CVE-2020-12866-CVE-2020-12864.patch
Patch0004: CVE-2020-12867.patch
Patch0005: Add-check-for-ports-to-avoid-Segmentation-fault.patch
%description
SANE (Scanner Access Now Easy) is a sane and simple interface to both local and networked scanners
@ -205,6 +206,9 @@ exit 0
%{_unitdir}/*
%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
- fix CVE-2020-12867