!5673 fix:modify udidhash is empty

Merge pull request !5673 from 房冬/master
This commit is contained in:
openharmony_ci 2024-04-08 13:42:25 +00:00 committed by Gitee
commit 9157498762
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 5 additions and 1 deletions

View File

@ -648,7 +648,10 @@ static void UpdateUdidHashIfEmpty(AuthFsm *authFsm, AuthSessionInfo *info)
{
if (info->connInfo.type == AUTH_LINK_TYPE_BLE && strlen(info->udid) != 0 &&
authFsm->info.connInfo.info.bleInfo.deviceIdHash[0] == '\0') {
AUTH_LOGW(AUTH_FSM, "udidhash is empty");
char *anonyUdid = NULL;
Anonymize(info->udid, &anonyUdid);
AUTH_LOGW(AUTH_FSM, "udidhash is empty, udid=%{public}s", anonyUdid);
AnonymizeFree(anonyUdid);
if (SoftBusGenerateStrHash((unsigned char *)info->udid, strlen(info->udid),
(unsigned char *)authFsm->info.connInfo.info.bleInfo.deviceIdHash) != SOFTBUS_OK) {
AUTH_LOGE(AUTH_FSM, "generate udidhash fail");

View File

@ -912,6 +912,7 @@ static int32_t VerifyExchangeIdTypeAndInfo(AuthSessionInfo *info, int32_t idType
if (GetPeerUdidByNetworkId(info->udid, peerUdid) != SOFTBUS_OK) {
AUTH_LOGE(AUTH_FSM, "get peer udid fail, peer networkId=%s", anonyUdid);
info->idType = EXCHANGE_FAIL;
(void)memset_s(info->udid, sizeof(info->udid), 0, sizeof(info->udid));
} else {
if (memcpy_s(info->udid, UDID_BUF_LEN, peerUdid, UDID_BUF_LEN) != EOK) {
AUTH_LOGE(AUTH_FSM, "copy peer udid fail");