1 Star 0 Fork 18

wang_yue111/sane-backends

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Add-check-for-ports-to-avoid-Segmentation-fault.patch 965 Bytes
一键复制 编辑 原始数据 按行查看 历史
lingsheng 提交于 2021-01-27 16:25 +08:00 . Add check for ports to avoid Segmentation fault
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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wang_yue111/sane-backends.git
git@gitee.com:wang_yue111/sane-backends.git
wang_yue111
sane-backends
sane-backends
master

搜索帮助

371d5123 14472233 46e8bd33 14472233