From 37502f18d4ef6cfce026a4d043b705f7d261aa00 Mon Sep 17 00:00:00 2001 From: hwyml Date: Thu, 4 Sep 2025 20:04:00 +0800 Subject: [PATCH] fix crash Signed-off-by: hwyml --- services/native/src/usb_right_db_helper.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/native/src/usb_right_db_helper.cpp b/services/native/src/usb_right_db_helper.cpp index 3270cffd..7a8d2049 100644 --- a/services/native/src/usb_right_db_helper.cpp +++ b/services/native/src/usb_right_db_helper.cpp @@ -64,6 +64,10 @@ bool UsbRightDbHelper::IsRecordExpired(int32_t uid, const std::string &deviceNam bool UsbRightDbHelper::IsRecordExpired(const struct UsbRightAppInfo &info, uint64_t expiredTime) { + if (expiredTime < info.requestTime) { + USB_HILOGW(MODULE_USB_SERVICE, "system time changed"); + return true; + } if (info.validPeriod == USB_RIGHT_VALID_PERIOD_MIN) { USB_HILOGD(MODULE_USB_SERVICE, "allow temporary"); return false; -- Gitee