From c57451455cd6d9e30af31b67c785b4519bea91df Mon Sep 17 00:00:00 2001 From: Wei Jiangang Date: Wed, 27 Mar 2024 16:50:27 +0800 Subject: [PATCH] Fix crash while authenticating Signed-off-by: Wei Jiangang replace patch 0003 Signed-off-by: Wei Jiangang --- ...-for-nullptr-in-EstablishAuthChannel.patch | 35 +++++++++++++++++++ device_manager.spec | 8 +++-- 2 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 0003-Fix-crash-for-nullptr-in-EstablishAuthChannel.patch diff --git a/0003-Fix-crash-for-nullptr-in-EstablishAuthChannel.patch b/0003-Fix-crash-for-nullptr-in-EstablishAuthChannel.patch new file mode 100644 index 0000000..2dd9a95 --- /dev/null +++ b/0003-Fix-crash-for-nullptr-in-EstablishAuthChannel.patch @@ -0,0 +1,35 @@ +From 0ed00210a137abe34c706bdb1058a7fe0bcb3dfe Mon Sep 17 00:00:00 2001 +From: Wei Jiangang +Date: Thu, 28 Mar 2024 12:13:57 +0800 +Subject: [PATCH] Fix crash for nullptr in EstablishAuthChannel + +Signed-off-by: Wei Jiangang +--- + .../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(); + 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()); + } +@@ -940,4 +942,4 @@ bool DmAuthManager::IsIdenticalAccount() + return true; + } + } // namespace DistributedHardware +-} // namespace OHOS +\ No newline at end of file ++} // namespace OHOS +-- +2.33.0 + diff --git a/device_manager.spec b/device_manager.spec index 6025318..42d7fa8 100644 --- a/device_manager.spec +++ b/device_manager.spec @@ -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 - 1.0.0-4 +- Fix crash while authenticating * Tue Mar 26 2024 tianhang - 1.0.0-3 - the auto parameter in device manager may cause the softbus to be abnormal - * Fri Dec 15 2023 heppen - 1.0.0-2 - Add SA profile - * Tue Oct 31 2023 Yuying Mu - 1.0.0-1 * Tue Nov 21 2023 Jiaqi Zhao - 1.0.0-1 - Init and adapt device manager to openEuler -- Gitee