diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler/handleronremotesourcesvrdied_fuzzer/onremotesourcesvrdied_fuzzer.cpp b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler/handleronremotesourcesvrdied_fuzzer/onremotesourcesvrdied_fuzzer.cpp index 72b35c381372f617b1dbf6687ae0a311dcef3770..eb0cab56946a6c152bd5b78501793877652c615b 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler/handleronremotesourcesvrdied_fuzzer/onremotesourcesvrdied_fuzzer.cpp +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler/handleronremotesourcesvrdied_fuzzer/onremotesourcesvrdied_fuzzer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -24,20 +24,20 @@ namespace OHOS { namespace DistributedHardware { +constexpr int32_t DISTRIBUTED_HARDWARE_DM_SA_ID = 4802; void OnRemoteSourceSvrDiedFuzzTest(const uint8_t* data, size_t size) { if ((data == nullptr) || (size < sizeof(int32_t))) { return; } - int32_t saId = *(reinterpret_cast(data)); sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); if (samgr == nullptr) { return; } - sptr remoteObject = samgr->GetSystemAbility(saId); + sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_DM_SA_ID); if (remoteObject == nullptr) { return; } diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_proxy/proxyconfigdistributedhardware_fuzzer/configdistributedhardware_fuzzer.cpp b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_proxy/proxyconfigdistributedhardware_fuzzer/configdistributedhardware_fuzzer.cpp index ee74553a51dff8843267557bc0e26015c9e08258..a7e8f34a01b21e56c1be7803698d2028321b4b65 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_proxy/proxyconfigdistributedhardware_fuzzer/configdistributedhardware_fuzzer.cpp +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_proxy/proxyconfigdistributedhardware_fuzzer/configdistributedhardware_fuzzer.cpp @@ -25,6 +25,7 @@ namespace OHOS { namespace DistributedHardware { +constexpr int32_t DISTRIBUTED_HARDWARE_DM_SA_ID = 4802; void ConfigDistributedHardwareFuzzTest(const uint8_t* data, size_t size) { if ((data == nullptr) || (size < sizeof(int32_t))) { @@ -41,8 +42,8 @@ void ConfigDistributedHardwareFuzzTest(const uint8_t* data, size_t size) if (samgr == nullptr) { return; } - int32_t saId = *(reinterpret_cast(data)); - sptr remoteObject = samgr->GetSystemAbility(saId); + + sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_DM_SA_ID); if (remoteObject == nullptr) { return; }