From 00147c262a2f2cf1d00acb66e2574dbad8257fc1 Mon Sep 17 00:00:00 2001 From: liumingyue Date: Thu, 18 Jul 2024 21:09:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=8A=E8=AD=A6=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liumingyue --- .../innerkits/appverify/src/provision/provision_verify.cpp | 2 ++ .../appverify/src/util/hap_cert_verify_openssl_utils.cpp | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/interfaces/innerkits/appverify/src/provision/provision_verify.cpp b/interfaces/innerkits/appverify/src/provision/provision_verify.cpp index 614a5f3..38f70c1 100644 --- a/interfaces/innerkits/appverify/src/provision/provision_verify.cpp +++ b/interfaces/innerkits/appverify/src/provision/provision_verify.cpp @@ -273,6 +273,7 @@ AppProvisionVerifyResult ParseProvision(const std::string& appProvision, Provisi { cJSON* obj = cJSON_Parse(appProvision.c_str()); if (obj == NULL || !cJSON_IsObject(obj)) { + cJSON_Delete(obj); return PROVISION_INVALID; } from_json(obj, info); @@ -386,6 +387,7 @@ AppProvisionVerifyResult ParseProfile(const std::string& appProvision, Provision { cJSON* jsonObj = cJSON_Parse(appProvision.c_str()); if (jsonObj == NULL || !cJSON_IsObject(jsonObj)) { + cJSON_Delete(jsonObj); return PROVISION_INVALID; } from_json(jsonObj, info); diff --git a/interfaces/innerkits/appverify/src/util/hap_cert_verify_openssl_utils.cpp b/interfaces/innerkits/appverify/src/util/hap_cert_verify_openssl_utils.cpp index abdb2a7..0066934 100644 --- a/interfaces/innerkits/appverify/src/util/hap_cert_verify_openssl_utils.cpp +++ b/interfaces/innerkits/appverify/src/util/hap_cert_verify_openssl_utils.cpp @@ -260,8 +260,9 @@ void HapCertVerifyOpensslUtils::WriteX509CrlToStream(std::ofstream& crlFile, X50 crlFile.seekp(posStart + sizeof(totalLen)); char buf[OPENSSL_READ_CRL_LEN_EACH_TIME]; int32_t readLen = BIO_read(derBio, buf, sizeof(buf)); - int32_t readTime = 0; - while (readLen > 0 && (++readTime < OPENSSL_READ_CRL_MAX_TIME)) { + int32_t readTime = 1; + while (readLen > 0 && (readTime < OPENSSL_READ_CRL_MAX_TIME)) { + readTime++; crlFile.write(buf, readLen); totalLen += readLen; readLen = BIO_read(derBio, buf, sizeof(buf));