!24 修复由于访问SPwd空指针引起的崩溃问题。

From: @tangjie02 
Reviewed-by: @liubuguiii 
Signed-off-by: @liubuguiii
This commit is contained in:
openeuler-ci-bot 2022-08-09 06:22:59 +00:00 committed by Gitee
commit 3397eb35d9
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 48 additions and 2 deletions

View File

@ -0,0 +1,41 @@
From 9b8ccb8e7e8f1d45315b984ecdbf0ab19870b3dd Mon Sep 17 00:00:00 2001
From: tangjie02 <tangjie02@kylinsec.com.cn>
Date: Tue, 9 Aug 2022 10:45:00 +0800
Subject: [PATCH] fix(coredump): Fix coredump problem caused by nullpointer to
SPwd
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 修复由于访问SPwd空指针引起的崩溃问题。
Signed-off-by: tangjie02 <tangjie02@kylinsec.com.cn>
---
plugins/accounts/accounts-wrapper.cpp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/plugins/accounts/accounts-wrapper.cpp b/plugins/accounts/accounts-wrapper.cpp
index 2cbee6c..4f313f6 100644
--- a/plugins/accounts/accounts-wrapper.cpp
+++ b/plugins/accounts/accounts-wrapper.cpp
@@ -42,13 +42,14 @@ std::vector<PasswdShadow> AccountsWrapper::get_passwds_shadows()
for (auto iter = this->passwds_.begin(); iter != this->passwds_.end(); ++iter)
{
auto spwd = this->spwds_.find(iter->first);
- if (spwd == this->spwds_.end())
+ // 如果spwd不存在可能是因为账户正在创建中这个时候不作为返回值避免出现处理空指针引起的崩溃问题
+ if (spwd != this->spwds_.end())
{
- passwds_shadows.push_back(std::make_pair(iter->second, nullptr));
+ passwds_shadows.push_back(std::make_pair(iter->second, spwd->second));
}
else
{
- passwds_shadows.push_back(std::make_pair(iter->second, spwd->second));
+ KLOG_DEBUG("The shadow info isn't found.");
}
}
--
2.33.0

View File

@ -1,11 +1,13 @@
Name: kiran-cc-daemon
Version: 2.3.1
Release: 1
Release: 2
Summary: DBus daemon for Kiran Desktop
License: Mulan PSL v2
License: MulanPSL-2.0
Source0: %{name}-%{version}.tar.gz
Patch0001: 0001-fix-coredump-Fix-coredump-problem-caused-by-nullpoin.patch
BuildRequires: cmake >= 3.2
BuildRequires: pkgconfig(glibmm-2.4)
@ -144,6 +146,9 @@ glib-compile-schemas /usr/share/glib-2.0/schemas &> /dev/nulls || :
%{_libdir}/pkgconfig/kiran-cc-daemon.pc
%changelog
* Tue Aug 09 2022 tangjie02 <tangjie02@kylinsec.com.cn> - 2.3.1-2
- KYOS-B: Fix coredump problem caused by nullpointer to SPwd.
* Thu Jul 28 2022 tangjie02 <tangjie02@kylinsec.com.cn> - 2.3.1-1
- KYOS-B: Fix the problem that system version shows empty content in comunity version. (#I5H4D6)
- KYOS-B: Fix the problem that system and sound classes in keybindings aren't shown.(#I5I6OU)