From 3ef360b92b6b356d65c16c20695995093cbccdcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E9=9B=B7?= Date: Wed, 23 Jul 2025 18:10:38 +0800 Subject: [PATCH 1/2] add fuzz MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张雷 --- .../src/relationshipsyncmgr/dm_transport.cpp | 2 + .../authenticate_device_fuzzer.cpp | 39 ++++++++++++++++-- .../device_manager_impl_fuzzer.cpp | 40 +++++++++++++++++++ .../dmcommtool_fuzzer/dm_comm_tool_fuzzer.cpp | 3 ++ .../dm_transport_fuzzer.cpp | 6 ++- 5 files changed, 84 insertions(+), 6 deletions(-) diff --git a/services/service/src/relationshipsyncmgr/dm_transport.cpp b/services/service/src/relationshipsyncmgr/dm_transport.cpp index 1bacbcc78..4ddf272a6 100644 --- a/services/service/src/relationshipsyncmgr/dm_transport.cpp +++ b/services/service/src/relationshipsyncmgr/dm_transport.cpp @@ -147,6 +147,7 @@ void DMTransport::HandleReceiveMessage(const int32_t socketId, const std::string dmCommToolSPtr->GetEventHandler()->SendEvent(msgEvent, 0, AppExecFwk::EventQueue::Priority::IMMEDIATE); } +//LCOV_EXCL_START std::shared_ptr GetDMCommToolPtr() { if (g_dmCommToolWPtr_.expired()) { @@ -162,6 +163,7 @@ std::shared_ptr GetDMCommToolPtr() return dmCommToolSPtr; } +//LCOV_EXCL_STOP void OnBind(int32_t socket, PeerSocketInfo info) { diff --git a/test/commonfuzztest/authenticatedevice_fuzzer/authenticate_device_fuzzer.cpp b/test/commonfuzztest/authenticatedevice_fuzzer/authenticate_device_fuzzer.cpp index 0303783de..87da397b1 100644 --- a/test/commonfuzztest/authenticatedevice_fuzzer/authenticate_device_fuzzer.cpp +++ b/test/commonfuzztest/authenticatedevice_fuzzer/authenticate_device_fuzzer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 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 @@ -226,6 +226,9 @@ void AuthenticateDeviceFirstFuzzTest(const uint8_t* data, size_t size) DeviceManager::GetInstance().RegisterDevStateCallback(emptyStr, str, g_stateCallback); DeviceManager::GetInstance().AuthenticateDevice(str, g_authType, g_deviceInfo, emptyStr, g_callbackk); DeviceManager::GetInstance().UnAuthenticateDevice(str, g_deviceInfo); + strncpy(g_deviceInfo.networkId, "networkId", sizeof(g_deviceInfo.networkId) - 1); + g_deviceInfo.networkId[sizeof(g_deviceInfo.networkId) - 1] = '\0'; + DeviceManager::GetInstance().UnAuthenticateDevice(str, g_deviceInfo); std::string pkgName = "pkgName"; DeviceManager::GetInstance().StartDeviceDiscovery(pkgName, g_subscribeInfo, pkgName, g_discoveryCallback); DeviceManager::GetInstance().StopDeviceDiscovery(str, g_subscribeInfo.subscribeId); @@ -255,6 +258,7 @@ void AuthenticateDeviceSecondFuzzTest(const uint8_t* data, size_t size) DeviceManager::GetInstance().GetUdidByNetworkId(str, str, g_returnStr); DeviceManager::GetInstance().GetUuidByNetworkId(str, str, g_returnStr); DeviceManager::GetInstance().DpAclAdd(g_accessControlId, str, g_bindType); + DeviceManager::GetInstance().DpAclAdd(g_accessControlId, str, INVALID_TYPE); DeviceManager::GetInstance().CreatePinHolder(str, g_targetId, g_pinType, str); DeviceManager::GetInstance().DestroyPinHolder(str, g_targetId, g_pinType, str); DeviceManager::GetInstance().CheckAccessToTarget(g_tokenId, str); @@ -291,6 +295,7 @@ void AuthenticateDeviceThirdFuzzTest(const uint8_t* data, size_t size) std::map authParam; authParam[DM_AUTHENTICATION_TYPE] = str; DeviceManager::GetInstance().RegisterAuthenticationType(str, authParam); + DeviceManager::GetInstance().RegisterAuthenticationType(emptyStr, authParam); } void AuthenticateDeviceFourthFuzzTest(const uint8_t* data, size_t size) @@ -300,7 +305,6 @@ void AuthenticateDeviceFourthFuzzTest(const uint8_t* data, size_t size) } AddPermission(); std::string str(reinterpret_cast(data), size); - DeviceManagerImpl::GetInstance().ipcClientProxy_ = std::make_shared(std::make_shared()); std::string emptyStr = ""; @@ -311,7 +315,6 @@ void AuthenticateDeviceFourthFuzzTest(const uint8_t* data, size_t size) int32_t numOneTwoTimes = 11; int32_t numOneThreeTimes = 111; int32_t numOneSixTimes = 111111; - DeviceManagerImpl::GetInstance().ConvertDeviceInfoToDeviceBasicInfo(info, deviceBasicInfo); DeviceManagerImpl::GetInstance().GetTrustedDeviceList(str, emptyStr, g_deviceList); DeviceManagerImpl::GetInstance().GetTrustedDeviceList(str, emptyStr, false, g_deviceList); @@ -322,9 +325,11 @@ void AuthenticateDeviceFourthFuzzTest(const uint8_t* data, size_t size) DeviceManagerImpl::GetInstance().StartDeviceDiscovery(str, g_subscribeInfo, emptyStr, nullptr); DeviceManagerImpl::GetInstance().StartDeviceDiscovery(str, numOneSixTimes, emptyStr, nullptr); DeviceManagerImpl::GetInstance().StopDeviceDiscovery(str, numOneTwoTimes); + DeviceManagerImpl::GetInstance().StopDeviceDiscovery(emptyStr, numOneTwoTimes); DeviceManagerImpl::GetInstance().StopDeviceDiscovery(numOneThreeTimes, ""); DeviceManagerImpl::GetInstance().PublishDeviceDiscovery(str, g_publishInfo, nullptr); DeviceManagerImpl::GetInstance().UnPublishDeviceDiscovery(str, numOneTwoTimes); + DeviceManagerImpl::GetInstance().UnPublishDeviceDiscovery(emptyStr, numOneTwoTimes); DeviceManagerImpl::GetInstance().AuthenticateDevice(str, numOne, info, emptyStr, nullptr); DeviceManagerImpl::GetInstance().RegisterDeviceManagerFaCallback(str, nullptr); DeviceManagerImpl::GetInstance().UnRegisterDeviceManagerFaCallback(str); @@ -367,14 +372,21 @@ void AuthenticateDeviceFifthFuzzTest(const uint8_t* data, size_t size) DeviceManagerImpl::GetInstance().RegisterDevStateCallback(str, emptyStr); DeviceManagerImpl::GetInstance().UnRegisterDevStateCallback(str, emptyStr); DeviceManagerImpl::GetInstance().RegisterUiStateCallback(str); + DeviceManagerImpl::GetInstance().RegisterUiStateCallback(emptyStr); + DeviceManagerImpl::GetInstance().UnRegisterUiStateCallback(emptyStr); DeviceManagerImpl::GetInstance().UnRegisterUiStateCallback(str); + DeviceManagerImpl::GetInstance().RequestCredential(emptyStr, g_reqJsonStr, g_returnStr); DeviceManagerImpl::GetInstance().RequestCredential(str, g_reqJsonStr, g_returnStr); DeviceManagerImpl::GetInstance().ImportCredential(str, emptyStr); DeviceManagerImpl::GetInstance().DeleteCredential(str, emptyStr); DeviceManagerImpl::GetInstance().RegisterCredentialCallback(str, nullptr); + DeviceManagerImpl::GetInstance().UnRegisterCredentialCallback(emptyStr); DeviceManagerImpl::GetInstance().UnRegisterCredentialCallback(str); + DeviceManagerImpl::GetInstance().NotifyEvent(emptyStr, 1, emptyStr); DeviceManagerImpl::GetInstance().NotifyEvent(str, 1, emptyStr); + DeviceManagerImpl::GetInstance().RequestCredential(emptyStr, g_returnStr); DeviceManagerImpl::GetInstance().RequestCredential(str, g_returnStr); + DeviceManagerImpl::GetInstance().CheckCredential(emptyStr, g_reqJsonStr, g_returnStr); DeviceManagerImpl::GetInstance().CheckCredential(str, g_reqJsonStr, g_returnStr); DeviceManagerImpl::GetInstance().GetEncryptedUuidByNetworkId(str, emptyStr, g_returnStr); DeviceManagerImpl::GetInstance().GenerateEncryptedUuid(str, emptyStr, emptyStr, g_returnStr); @@ -391,7 +403,9 @@ void AuthenticateDeviceFifthFuzzTest(const uint8_t* data, size_t size) void AuthenticateDeviceSixthFuzzTest(const uint8_t* data, size_t size) { - if ((data == nullptr) || (size == 0)) { + int32_t maxStringLength = 10; + size_t requiredSize = maxStringLength * 9; + if ((data == nullptr) || (size < requiredSize)) { return; } AddPermission(); @@ -401,15 +415,22 @@ void AuthenticateDeviceSixthFuzzTest(const uint8_t* data, size_t size) std::string emptyStr = ""; int32_t indexTwo = 2; std::map discoverParam; + std::map policy; + policy[fdp.ConsumeRandomLengthString(maxStringLength)] = fdp.ConsumeRandomLengthString(maxStringLength); + policy[fdp.ConsumeRandomLengthString(maxStringLength)] = fdp.ConsumeRandomLengthString(maxStringLength); DeviceManagerImpl::GetInstance().StartDiscovering(str, discoverParam, discoverParam, nullptr); DeviceManagerImpl::GetInstance().StopDiscovering(str, discoverParam); + DeviceManagerImpl::GetInstance().StopDiscovering(emptyStr, discoverParam); + DeviceManagerImpl::GetInstance().RegisterDiscoveryCallback(str, discoverParam, discoverParam, g_discoveryCallback); DeviceManagerImpl::GetInstance().RegisterDiscoveryCallback(str, discoverParam, discoverParam, nullptr); DeviceManagerImpl::GetInstance().UnRegisterDiscoveryCallback(str); DeviceManagerImpl::GetInstance().UnRegisterDiscoveryCallback(emptyStr); DeviceManagerImpl::GetInstance().StartAdvertising(str, discoverParam, nullptr); DeviceManagerImpl::GetInstance().StartAdvertising(str, discoverParam, g_publishCallback); + DeviceManagerImpl::GetInstance().StopAdvertising(emptyStr, discoverParam); DeviceManagerImpl::GetInstance().StopAdvertising(str, discoverParam); DeviceManagerImpl::GetInstance().SetDnPolicy(str, discoverParam); + DeviceManagerImpl::GetInstance().SetDnPolicy(str, policy); DeviceManagerImpl::GetInstance().RegisterDeviceScreenStatusCallback(emptyStr, nullptr); DeviceManagerImpl::GetInstance().UnRegisterDeviceScreenStatusCallback(emptyStr); std::shared_ptr callback = std::make_shared(); @@ -417,6 +438,16 @@ void AuthenticateDeviceSixthFuzzTest(const uint8_t* data, size_t size) DeviceManagerImpl::GetInstance().UnRegisterDeviceScreenStatusCallback(str); DeviceManagerImpl::GetInstance().GetDeviceScreenStatus(emptyStr, emptyStr, indexTwo); DeviceManagerImpl::GetInstance().GetDeviceScreenStatus(str, str, indexTwo); + PeerTargetId targetId; + targetId.deviceId = fdp.ConsumeRandomLengthString(maxStringLength); + targetId.brMac = fdp.ConsumeRandomLengthString(maxStringLength); + targetId.bleMac = fdp.ConsumeRandomLengthString(maxStringLength); + targetId.wifiIp = fdp.ConsumeRandomLengthString(maxStringLength); + DeviceManagerImpl::GetInstance().BindTarget(str, targetId, discoverParam, nullptr); + DeviceManagerImpl::GetInstance().UnbindTarget(str, targetId, discoverParam, nullptr); + DeviceManagerImpl::GetInstance().GetTrustedDeviceList(emptyStr, emptyStr, false, g_deviceList); + DeviceManagerImpl::GetInstance().UnRegisterDeviceManagerFaCallback(emptyStr); + DeviceManagerImpl::GetInstance().GetTrustedDeviceList(emptyStr, discoverParam, false, g_deviceList); } } } diff --git a/test/interfacesfuzztest/devicemanagerimpl_fuzzer/device_manager_impl_fuzzer.cpp b/test/interfacesfuzztest/devicemanagerimpl_fuzzer/device_manager_impl_fuzzer.cpp index a9285a436..495299171 100755 --- a/test/interfacesfuzztest/devicemanagerimpl_fuzzer/device_manager_impl_fuzzer.cpp +++ b/test/interfacesfuzztest/devicemanagerimpl_fuzzer/device_manager_impl_fuzzer.cpp @@ -47,6 +47,8 @@ void StopAuthenticateDeviceTest(const uint8_t *data, size_t size) FuzzedDataProvider fdp(data, size); std::string pkgName = fdp.ConsumeRandomLengthString(); DeviceManagerImpl::GetInstance().StopAuthenticateDevice(pkgName); + std::string emptyPkgName = ""; + DeviceManagerImpl::GetInstance().StopAuthenticateDevice(emptyPkgName); DeviceManagerImpl::GetInstance().OnDmServiceDied(); } @@ -94,6 +96,7 @@ void GetNetworkIdByUdidTest(const uint8_t *data, size_t size) std::string udid = fdp.ConsumeRandomLengthString(); std::string networkId = fdp.ConsumeRandomLengthString(); DeviceManagerImpl::GetInstance().GetNetworkIdByUdid(pkgName, udid, networkId); + DeviceManagerImpl::GetInstance().GetNetworkIdByUdid("pkgName", "udid", networkId); } void RegisterCredentialAuthStatusCallbackTest(const uint8_t *data, size_t size) @@ -121,6 +124,8 @@ void GetAllTrustedDeviceListTest(const uint8_t *data, size_t size) std::string extra = fdp.ConsumeRandomLengthString(); std::vector deviceList; DeviceManagerImpl::GetInstance().GetAllTrustedDeviceList(pkgName, extra, deviceList); + std::string emptyPkgName = ""; + DeviceManagerImpl::GetInstance().GetAllTrustedDeviceList(emptyPkgName, extra, deviceList); } void RegisterSinkBindCallbackTest(const uint8_t *data, size_t size) @@ -132,6 +137,8 @@ void RegisterSinkBindCallbackTest(const uint8_t *data, size_t size) std::string pkgName = fdp.ConsumeRandomLengthString(); std::shared_ptr callback = nullptr; DeviceManagerImpl::GetInstance().RegisterSinkBindCallback(pkgName, callback); + std::string emptyPkgName = ""; + DeviceManagerImpl::GetInstance().RegisterSinkBindCallback(emptyPkgName, callback); } void GetDeviceProfileInfoListTest(const uint8_t *data, size_t size) @@ -226,6 +233,8 @@ void RestoreLocalDeviceNameTest(const uint8_t *data, size_t size) FuzzedDataProvider fdp(data, size); std::string pkgName = fdp.ConsumeRandomLengthString(); DeviceManagerImpl::GetInstance().RestoreLocalDeviceName(pkgName); + std::string emptyPkgName = ""; + DeviceManagerImpl::GetInstance().RestoreLocalDeviceName(emptyPkgName); } void GetLocalServiceInfoByBundleNameAndPinExchangeTypeTest(const uint8_t *data, size_t size) @@ -258,6 +267,8 @@ void UnRegisterPinHolderCallbackTest(const uint8_t *data, size_t size) FuzzedDataProvider fdp(data, size); std::string pkgName = fdp.ConsumeRandomLengthString(); DeviceManagerImpl::GetInstance().UnRegisterPinHolderCallback(pkgName); + std::string emptyPkgName = ""; + DeviceManagerImpl::GetInstance().UnRegisterPinHolderCallback(emptyPkgName); } void DeviceManagerImplFuzzTest(const uint8_t *data, size_t size) @@ -280,7 +291,9 @@ void DeviceManagerImplFuzzTest(const uint8_t *data, size_t size) DeviceManagerImpl::GetInstance().GetLocalDeviceName(pkgName, deviceName); DeviceManagerImpl::GetInstance().GetLocalDeviceName(pkgName); DeviceManagerImpl::GetInstance().UnBindDevice(pkgName, deviceId, extra); + DeviceManagerImpl::GetInstance().UnBindDevice("pkgName", "deviceId", extra); DeviceManagerImpl::GetInstance().UnRegisterSinkBindCallback(pkgName); + DeviceManagerImpl::GetInstance().UnRegisterSinkBindCallback(""); DeviceManagerImpl::GetInstance().RegisterLocalServiceInfo(localServiceInfo); DeviceManagerImpl::GetInstance().UnRegisterLocalServiceInfo(bundleName, pinExchangeType); DeviceManagerImpl::GetInstance().UpdateLocalServiceInfo(localServiceInfo); @@ -292,6 +305,32 @@ void DeviceManagerImplFuzzTest(const uint8_t *data, size_t size) DeviceManagerImpl::GetInstance().CheckSinkIsSameAccount(caller, callee); DeviceManagerImpl::GetInstance().CheckAclByIpcCode(caller, callee, ipcCode); } + +void SyncCallbacksToServiceFuzzTest(const uint8_t* data, size_t size) +{ + int32_t maxStringLength = 64; + if (data == nullptr || size < sizeof(int32_t) + maxStringLength) { + return; + } + + FuzzedDataProvider fdp(data, size); + + std::map> callbackMap; + DeviceManagerImpl::GetInstance().SyncCallbacksToService(callbackMap); + + int32_t minCount = 1; + int32_t maxCount = 5; + DmCommonNotifyEvent event = static_cast(fdp.ConsumeIntegral()); + std::set pkgNames; + callbackMap[event] = pkgNames; + DeviceManagerImpl::GetInstance().SyncCallbacksToService(callbackMap); + int32_t pkgCount = fdp.ConsumeIntegralInRange(minCount, maxCount); + for (int32_t j = 0; j < pkgCount; ++j) { + pkgNames.insert(fdp.ConsumeRandomLengthString(maxStringLength)); + } + callbackMap[event] = pkgNames; + DeviceManagerImpl::GetInstance().SyncCallbacksToService(callbackMap); +} } } @@ -319,5 +358,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) OHOS::DistributedHardware::UnRegisterPinHolderCallbackTest(data, size); OHOS::DistributedHardware::DeviceManagerImplFuzzTest(data, size); OHOS::DistributedHardware::GetErrorCodeTest(data, size); + OHOS::DistributedHardware::SyncCallbacksToServiceFuzzTest(data, size); return 0; } diff --git a/test/servicesfuzztest/dmcommtool_fuzzer/dm_comm_tool_fuzzer.cpp b/test/servicesfuzztest/dmcommtool_fuzzer/dm_comm_tool_fuzzer.cpp index d38acab88..f2d4d777f 100644 --- a/test/servicesfuzztest/dmcommtool_fuzzer/dm_comm_tool_fuzzer.cpp +++ b/test/servicesfuzztest/dmcommtool_fuzzer/dm_comm_tool_fuzzer.cpp @@ -95,10 +95,13 @@ void DmCommToolFirstFuzzTest(const uint8_t* data, size_t size) int32_t userId = fdp.ConsumeIntegral(); int32_t tokenId = fdp.ConsumeIntegral(); dmCommToolPtr_->SendUninstAppObj(userId, tokenId, rmtNetworkId); + std::string emptyNetworkId = ""; + dmCommToolPtr_->SendUninstAppObj(userId, tokenId, emptyNetworkId); dmCommToolPtr_->RspAppUninstall(rmtNetworkId, socketId); dmCommToolPtr_->RspAppUnbind(rmtNetworkId, socketId); std::string udid = fdp.ConsumeRandomLengthString(); dmCommToolPtr_->SendUnBindAppObj(userId, tokenId, msg, rmtNetworkId, udid); + dmCommToolPtr_->SendUnBindAppObj(userId, tokenId, msg, emptyNetworkId, udid); dmCommToolPtr_->StopSocket(rmtNetworkId); } } diff --git a/test/servicesfuzztest/dmtransport_fuzzer/dm_transport_fuzzer.cpp b/test/servicesfuzztest/dmtransport_fuzzer/dm_transport_fuzzer.cpp index f01ed0edf..025513e8f 100644 --- a/test/servicesfuzztest/dmtransport_fuzzer/dm_transport_fuzzer.cpp +++ b/test/servicesfuzztest/dmtransport_fuzzer/dm_transport_fuzzer.cpp @@ -71,7 +71,6 @@ void DmTransPortFirstFuzzTest(const uint8_t* data, size_t size) if ((data == nullptr) || (size < sizeof(int32_t))) { return; } - const char* jsonString = R"({ "MsgType": "0", "userId": "12345", @@ -85,7 +84,6 @@ void DmTransPortFirstFuzzTest(const uint8_t* data, size_t size) {"type": 0, "userId": 222} ] })"; - std::string payload(jsonString); FuzzedDataProvider fdp(data, size); int32_t socketId = fdp.ConsumeIntegral(); @@ -108,12 +106,16 @@ void DmTransPortFirstFuzzTest(const uint8_t* data, size_t size) dmTransPortPtr_->StartSocket(rmtNetworkId, socketId); dmTransPortPtr_->StopSocket(rmtNetworkId); dmTransPortPtr_->Send(rmtNetworkId, payload, socketId); + dmTransPortPtr_->IsDeviceSessionOpened(rmtNetworkId, socketId); + dmTransPortPtr_->ClearDeviceSocketOpened(rmtNetworkId, socketId); rmtNetworkId = "rmtNetworkId"; dmTransPortPtr_->CreateClientSocket(rmtNetworkId); dmTransPortPtr_->UnInit(); dmTransPortPtr_->IsDeviceSessionOpened(rmtNetworkId, socketId); std::string remoteDevId(reinterpret_cast(data), size); dmTransPortPtr_->ClearDeviceSocketOpened(remoteDevId, socketId); + socketId = 1; + dmTransPortPtr_->Send(rmtNetworkId, payload, socketId); } void DmTransPortSecondFuzzTest(const uint8_t* data, size_t size) -- Gitee From bdfc6c1b38ad8c761c9d60a3402bcca3793fd2ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E9=9B=B7?= Date: Wed, 23 Jul 2025 10:35:33 +0000 Subject: [PATCH 2/2] update test/commonfuzztest/authenticatedevice_fuzzer/authenticate_device_fuzzer.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张雷 --- .../authenticatedevice_fuzzer/authenticate_device_fuzzer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/commonfuzztest/authenticatedevice_fuzzer/authenticate_device_fuzzer.cpp b/test/commonfuzztest/authenticatedevice_fuzzer/authenticate_device_fuzzer.cpp index 87da397b1..d315ab96b 100644 --- a/test/commonfuzztest/authenticatedevice_fuzzer/authenticate_device_fuzzer.cpp +++ b/test/commonfuzztest/authenticatedevice_fuzzer/authenticate_device_fuzzer.cpp @@ -226,7 +226,7 @@ void AuthenticateDeviceFirstFuzzTest(const uint8_t* data, size_t size) DeviceManager::GetInstance().RegisterDevStateCallback(emptyStr, str, g_stateCallback); DeviceManager::GetInstance().AuthenticateDevice(str, g_authType, g_deviceInfo, emptyStr, g_callbackk); DeviceManager::GetInstance().UnAuthenticateDevice(str, g_deviceInfo); - strncpy(g_deviceInfo.networkId, "networkId", sizeof(g_deviceInfo.networkId) - 1); + strncpy_s(g_deviceInfo.networkId, sizeof(g_deviceInfo.networkId), "networkId", sizeof(g_deviceInfo.networkId) - 1); g_deviceInfo.networkId[sizeof(g_deviceInfo.networkId) - 1] = '\0'; DeviceManager::GetInstance().UnAuthenticateDevice(str, g_deviceInfo); std::string pkgName = "pkgName"; -- Gitee