Fix crash while authenticating

Signed-off-by: Wei Jiangang <wei_jiangang@hoperun.com>

replace patch 0003

Signed-off-by: Wei Jiangang <wei_jiangang@hoperun.com>
This commit is contained in:
Wei Jiangang 2024-03-27 16:50:27 +08:00
parent f51dd9777e
commit c57451455c
2 changed files with 40 additions and 3 deletions

View File

@ -0,0 +1,35 @@
From 0ed00210a137abe34c706bdb1058a7fe0bcb3dfe Mon Sep 17 00:00:00 2001
From: Wei Jiangang <wei_jiangang@hoperun.com>
Date: Thu, 28 Mar 2024 12:13:57 +0800
Subject: [PATCH] Fix crash for nullptr in EstablishAuthChannel
Signed-off-by: Wei Jiangang <wei_jiangang@hoperun.com>
---
.../implementation/src/authentication/dm_auth_manager.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/services/implementation/src/authentication/dm_auth_manager.cpp b/services/implementation/src/authentication/dm_auth_manager.cpp
index 4b0fbd91..2874bec6 100644
--- a/services/implementation/src/authentication/dm_auth_manager.cpp
+++ b/services/implementation/src/authentication/dm_auth_manager.cpp
@@ -426,7 +426,9 @@ int32_t DmAuthManager::EstablishAuthChannel(const std::string &deviceId)
LOGE("OpenAuthSession failed, stop the authentication");
authResponseContext_ = std::make_shared<DmAuthResponseContext>();
authResponseContext_->state = AuthState::AUTH_REQUEST_NEGOTIATE;
- authRequestContext_->reason = ERR_DM_AUTH_OPEN_SESSION_FAILED;
+ if (authRequestContext_ != nullptr) {
+ authRequestContext_->reason = ERR_DM_AUTH_OPEN_SESSION_FAILED;
+ }
if (authRequestState_ != nullptr) {
authRequestState_->TransitionTo(std::make_shared<AuthRequestFinishState>());
}
@@ -940,4 +942,4 @@ bool DmAuthManager::IsIdenticalAccount()
return true;
}
} // namespace DistributedHardware
-} // namespace OHOS
\ No newline at end of file
+} // namespace OHOS
--
2.33.0

View File

@ -8,7 +8,7 @@
Name: distributedhardware_device_manager
Version: 1.0.0
Release: 3
Release: 4
Summary: Distributed middleware used components.
License: Apache-2.0
Url: https://gitee.com/openharmony/
@ -20,6 +20,7 @@ Source5: device_manager.xml
Patch1: 0001-remove-dependency-and-adapt-for-build-device_manager.patch
Patch2: 0002-device-manager-only-support-for-network.patch
Patch3: 0003-Fix-crash-for-nullptr-in-EstablishAuthChannel.patch
BuildRequires: gcc, make, hilog, kernel-devel, uname-build-checks
BuildRequires: distributed-build, distributed-beget
@ -54,6 +55,7 @@ cp -rf %{_builddir}/build/openeuler/compiler_gn/* %{_builddir}
%setup -q -D -T -a 1 -c -n %{distributedhardware_dir}/
%patch -P1 -p1 -d %{distributedhardware_dir}/device_manager
%patch -P2 -p1 -d %{distributedhardware_dir}/device_manager
%patch -P3 -p1 -d %{distributedhardware_dir}/device_manager
%setup -q -D -T -a 2 -c -n %{third_party_dir}/
@ -116,12 +118,12 @@ ln -s /usr/include/device_manager %{buildroot}%{build_opt}/openeuler/compiler_gn
/system/*
%changelog
* Wed Mar 27 2024 wei_jiangang <wei_jiangang@hoperun.com> - 1.0.0-4
- Fix crash while authenticating
* Tue Mar 26 2024 tianhang <tian_hang@hoperun.com> - 1.0.0-3
- the auto parameter in device manager may cause the softbus to be abnormal
* Fri Dec 15 2023 heppen <hepeng68@huawei.com> - 1.0.0-2
- Add SA profile
* Tue Oct 31 2023 Yuying Mu <muyuying1@huawei.com> - 1.0.0-1
* Tue Nov 21 2023 Jiaqi Zhao <zhaojiaqi18@huawei.com> - 1.0.0-1
- Init and adapt device manager to openEuler