diff --git a/interfaces/innerkits/nativetoken/src/nativetoken_json_oper.c b/interfaces/innerkits/nativetoken/src/nativetoken_json_oper.c index 4830a1d80877921c7a803dfde18931022f3712fd..07cff0c139ea9220f88abeec8a3e0de590d01a7a 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 dba863a610938480718732a8cdf4b71dbb81e995..fbf6a6f0d37e72f5596754c866a8fed178fc1b6f 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\","