From 351bda81f8777ed73f39e06977c8f1e4444d1925 Mon Sep 17 00:00:00 2001 From: lishuo Date: Tue, 27 May 2025 17:33:44 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20token=E5=88=A4=E7=A9=BA=E4=BF=9D?= =?UTF-8?q?=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frameworks/native/running_lock.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frameworks/native/running_lock.cpp b/frameworks/native/running_lock.cpp index 56ea986f..52aebb4c 100644 --- a/frameworks/native/running_lock.cpp +++ b/frameworks/native/running_lock.cpp @@ -93,6 +93,10 @@ ErrCode RunningLock::Lock(int32_t timeOutMs) POWER_HILOGE(FEATURE_RUNNING_LOCK, "LProxy=null"); return E_GET_POWER_SERVICE_FAILED; } + if (token_ == nullptr) { + POWER_HILOGE(FEATURE_RUNNING_LOCK, "token_=nullptr"); + return PowerErrors::ERR_CONNECTION_FAIL; + } POWER_HILOGD(FEATURE_RUNNING_LOCK, "Service side Lock call, timeOutMs=%{public}d", timeOutMs); if (runningLockInfo_.type == RunningLockType::RUNNINGLOCK_PROXIMITY_SCREEN_CONTROL) { timeOutMs = NOT_USE_TIMEOUT; -- Gitee From f34038eda71df6269699d245b9de8b2a78a1a025 Mon Sep 17 00:00:00 2001 From: lishuo Date: Tue, 27 May 2025 17:33:44 +0800 Subject: [PATCH 2/2] fix: token null check protection --- frameworks/native/running_lock.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frameworks/native/running_lock.cpp b/frameworks/native/running_lock.cpp index 56ea986f..52aebb4c 100644 --- a/frameworks/native/running_lock.cpp +++ b/frameworks/native/running_lock.cpp @@ -93,6 +93,10 @@ ErrCode RunningLock::Lock(int32_t timeOutMs) POWER_HILOGE(FEATURE_RUNNING_LOCK, "LProxy=null"); return E_GET_POWER_SERVICE_FAILED; } + if (token_ == nullptr) { + POWER_HILOGE(FEATURE_RUNNING_LOCK, "token_=nullptr"); + return PowerErrors::ERR_CONNECTION_FAIL; + } POWER_HILOGD(FEATURE_RUNNING_LOCK, "Service side Lock call, timeOutMs=%{public}d", timeOutMs); if (runningLockInfo_.type == RunningLockType::RUNNINGLOCK_PROXIMITY_SCREEN_CONTROL) { timeOutMs = NOT_USE_TIMEOUT; -- Gitee