From c0a828dee44b0e932f1d0b8366c4321abf5162be Mon Sep 17 00:00:00 2001 From: 18734571586 Date: Mon, 20 Feb 2023 14:06:17 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=B4=A6=E5=8F=B7=E9=95=BF?= =?UTF-8?q?=E5=BA=A6=E4=B8=8D=E4=B8=80=E5=87=BA=E7=8E=B0=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E5=AD=97=E7=AC=A6=E4=B8=B2=E5=88=B0=E5=AD=97?= =?UTF-8?q?=E8=8A=82=E8=BD=AC=E6=8D=A2=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20Signed-off-by:=2018734571586=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/adapter/bus_center/src/lnn_ohos_account.cpp | 2 +- core/common/utils/softbus_utils.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/adapter/bus_center/src/lnn_ohos_account.cpp b/core/adapter/bus_center/src/lnn_ohos_account.cpp index 429a86066f..581921cfa8 100644 --- a/core/adapter/bus_center/src/lnn_ohos_account.cpp +++ b/core/adapter/bus_center/src/lnn_ohos_account.cpp @@ -63,7 +63,7 @@ NO_SANITIZE("cfi") int32_t LnnGetOhosAccountInfo(uint8_t *accountHash, uint32_t SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_INFO, "GetOhosAccount get default account hash"); return SOFTBUS_OK; } - + return ConvertHexStringToBytes(reinterpret_cast(accountHash), len, accountInfo.second.uid_.c_str(), accountInfo.second.uid_.length()); } diff --git a/core/common/utils/softbus_utils.c b/core/common/utils/softbus_utils.c index 676e13392a..a7a3039165 100644 --- a/core/common/utils/softbus_utils.c +++ b/core/common/utils/softbus_utils.c @@ -136,7 +136,11 @@ NO_SANITIZE("cfi") int32_t ConvertHexStringToBytes(unsigned char *outBuf, uint32 uint32_t inLen) { (void)outBufLen; - if ((outBuf == NULL) || (inBuf == NULL) || (inLen % HEXIFY_UNIT_LEN != 0)) { + if (inLen % HEXIFY_UNIT_LEN != 0) { + inLen -= 1; + } + + if ((outBuf == NULL) || (inBuf == NULL)) { SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "invalid param"); return SOFTBUS_ERR; } -- Gitee