diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxysubscribelocalhardware_fuzzer/subscribelocalhardware_fuzzer.cpp b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxysubscribelocalhardware_fuzzer/subscribelocalhardware_fuzzer.cpp index 87d9c445baa73ec0d62cb5e2cdb9989e4f44f4a5..17eff228daef25e2112fafa565ebb00d8a9e6a79 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxysubscribelocalhardware_fuzzer/subscribelocalhardware_fuzzer.cpp +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxysubscribelocalhardware_fuzzer/subscribelocalhardware_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 @@ -25,6 +25,7 @@ namespace OHOS { namespace DistributedHardware { +constexpr int32_t DISTRIBUTED_HARDWARE_DM_SA_ID = 4802; void SubscribeLocalHardwareFuzzTest(const uint8_t* data, size_t size) { if ((data == nullptr) || (size == 0)) { @@ -39,8 +40,8 @@ void SubscribeLocalHardwareFuzzTest(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; } diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxyunsubscribelocalhardware_fuzzer/unsubscribelocalhardware_fuzzer.cpp b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxyunsubscribelocalhardware_fuzzer/unsubscribelocalhardware_fuzzer.cpp index 7c39d54c5f626133ba131e88bb7905eb9059c8d9..7631c026da39d3a1f69805492597454a1bc99343 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxyunsubscribelocalhardware_fuzzer/unsubscribelocalhardware_fuzzer.cpp +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxyunsubscribelocalhardware_fuzzer/unsubscribelocalhardware_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 @@ -25,6 +25,7 @@ namespace OHOS { namespace DistributedHardware { +constexpr int32_t DISTRIBUTED_HARDWARE_DM_SA_ID = 4802; void UnsubscribeLocalHardwareFuzzTest(const uint8_t* data, size_t size) { if ((data == nullptr) || (size == 0)) { @@ -39,7 +40,7 @@ void UnsubscribeLocalHardwareFuzzTest(const uint8_t* data, size_t size) return; } - sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_SCREEN_SINK_SA_ID); + sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_DM_SA_ID); if (remoteObject == nullptr) { return; } diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/sinkproxydscreennotify_fuzzer/sinkproxydscreennotify_fuzzer.cpp b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/sinkproxydscreennotify_fuzzer/sinkproxydscreennotify_fuzzer.cpp index 0d97564c6f085fc11646c8983d0489c5a5340666..557544d5c5ad58200c7e67c13fd1e47de6a320c5 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/sinkproxydscreennotify_fuzzer/sinkproxydscreennotify_fuzzer.cpp +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/sinkproxydscreennotify_fuzzer/sinkproxydscreennotify_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 @@ -25,6 +25,7 @@ namespace OHOS { namespace DistributedHardware { +constexpr int32_t DISTRIBUTED_HARDWARE_DM_SA_ID = 4802; void DScreenNotifyFuzzTest(const uint8_t* data, size_t size) { if ((data == nullptr) || (size < sizeof(int32_t))) { @@ -40,8 +41,8 @@ void DScreenNotifyFuzzTest(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; } diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_proxy/proxydscreennotify_fuzzer/dscreennotify_fuzzer.cpp b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_proxy/proxydscreennotify_fuzzer/dscreennotify_fuzzer.cpp index 32acc0823bfa30ca3c05c2bccd93737a7a7ab488..85ac6c866205095bc24f520ba1bfa0905d3af4e4 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_proxy/proxydscreennotify_fuzzer/dscreennotify_fuzzer.cpp +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_proxy/proxydscreennotify_fuzzer/dscreennotify_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 @@ -25,6 +25,7 @@ namespace OHOS { namespace DistributedHardware { +constexpr int32_t DISTRIBUTED_HARDWARE_DM_SA_ID = 4802; void DScreenNotifyFuzzTest(const uint8_t* data, size_t size) { if ((data == nullptr) || (size < sizeof(int32_t))) { @@ -41,7 +42,7 @@ void DScreenNotifyFuzzTest(const uint8_t* data, size_t size) return; } - sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_SCREEN_SOURCE_SA_ID); + sptr remoteObject = samgr->GetSystemAbility(DISTRIBUTED_HARDWARE_DM_SA_ID); if (remoteObject == nullptr) { return; }