From 2c9644f3be826023caf31bde24680b22af9c82e1 Mon Sep 17 00:00:00 2001 From: xia-bubai Date: Mon, 14 Apr 2025 22:50:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E9=99=A4init=20=E8=AF=BBnativetoken.j?= =?UTF-8?q?son=E6=97=B6=E6=9D=83=E9=99=90=E6=95=B0=E9=87=8F=E4=B8=8Edcaps?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E6=9C=80=E5=A4=A7=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xia-bubai --- interfaces/innerkits/nativetoken/src/nativetoken_json_oper.c | 4 ---- .../nativetoken/test/unittest/src/nativetoken_oper_test.cpp | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/interfaces/innerkits/nativetoken/src/nativetoken_json_oper.c b/interfaces/innerkits/nativetoken/src/nativetoken_json_oper.c index 4830a1d80..07cff0c13 100644 --- a/interfaces/innerkits/nativetoken/src/nativetoken_json_oper.c +++ b/interfaces/innerkits/nativetoken/src/nativetoken_json_oper.c @@ -83,10 +83,6 @@ uint32_t GetInfoArrFromJson(cJSON *cjsonItem, char *strArr[], int32_t *strNum, S { cJSON *strArrJson = cJSON_GetObjectItem(cjsonItem, attr->strKey); int32_t size = cJSON_GetArraySize(strArrJson); - if (size > attr->maxStrNum) { - NativeTokenKmsg(NATIVETOKEN_KERROR, "[%s]:size = %d is invalid.", __func__, size); - return ATRET_FAILED; - } *strNum = size; for (int32_t i = 0; i < size; i++) { diff --git a/interfaces/innerkits/nativetoken/test/unittest/src/nativetoken_oper_test.cpp b/interfaces/innerkits/nativetoken/test/unittest/src/nativetoken_oper_test.cpp index dba863a61..fbf6a6f0d 100644 --- a/interfaces/innerkits/nativetoken/test/unittest/src/nativetoken_oper_test.cpp +++ b/interfaces/innerkits/nativetoken/test/unittest/src/nativetoken_oper_test.cpp @@ -184,7 +184,7 @@ HWTEST_F(TokenOperTest, GetInfoArrFromJson001, TestSize.Level1) "\"dcaps\":[\"DCAPS_AT\",\"DCAPS_AT\", \"DCAPS_AT\",\"DCAPS_AT\"]," "\"permissions\":[],\"nativeAcls\":[]}"; cJSON* jsonroot = cJSON_Parse(stringJson1); - EXPECT_NE(GetInfoArrFromJson(jsonroot, test, &resSize, &attr), 0); + EXPECT_EQ(GetInfoArrFromJson(jsonroot, test, &resSize, &attr), 0); cJSON_Delete(jsonroot); stringJson1 = "{\"processName\":\"partitionslot_host\"," -- Gitee