From a986f16958929a2ef77c94ea918eb923ef3c6bff Mon Sep 17 00:00:00 2001 From: openharmony_ci <120357966@qq.com> Date: Tue, 16 Apr 2024 16:34:40 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=AE=89=E5=85=A8=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lichao --- interfaces/inner_api/syscap_interface.c | 4 ++++ src/create_pcid.c | 13 +++++++++++-- src/main.c | 10 ++++++++-- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/interfaces/inner_api/syscap_interface.c b/interfaces/inner_api/syscap_interface.c index 4eb457c..d28800a 100644 --- a/interfaces/inner_api/syscap_interface.c +++ b/interfaces/inner_api/syscap_interface.c @@ -119,6 +119,10 @@ bool EncodePrivateSyscap(char **output, int *outputLen) return false; } + if (bufferLen < (PCID_MAIN_BYTES + 1) || bufferLen > INT32_MAX) { + PRINT_ERR("Parameter bufferLen out of range."); + return false; + } uint32_t priLen = bufferLen - PCID_MAIN_BYTES - 1; if ((int)priLen <= 0) { *outputLen = 0; diff --git a/src/create_pcid.c b/src/create_pcid.c index cea4e57..30cd37e 100644 --- a/src/create_pcid.c +++ b/src/create_pcid.c @@ -254,6 +254,7 @@ int32_t CreatePCID(char *inputFile, char *outDirPath) cJSON *jsonSyscapObj = cJSON_GetObjectItem(jsonRootObj, "syscap"); if (jsonSyscapObj == NULL || !cJSON_IsObject(jsonSyscapObj)) { PRINT_ERR("get \"syscap\" object failed\n"); + cJSON_Delete(jsonRootObj); return FreeAfterCreatePCID(NULL, allOsSyscapObj, contextBuffer, 0, -1); } @@ -267,6 +268,7 @@ int32_t CreatePCID(char *inputFile, char *outDirPath) uint16_t allPriSyscapStrLen = 0; ret = GetPriSyscapLen(privateCapSize, jsonPriSyscapObj, &allPriSyscapStrLen); if (ret != 0) { + cJSON_Delete(jsonRootObj); return FreeAfterCreatePCID(NULL, allOsSyscapObj, contextBuffer, 0, ret); } @@ -274,6 +276,7 @@ int32_t CreatePCID(char *inputFile, char *outDirPath) PCIDMain *pcidBuffer = (PCIDMain *)malloc(pcidLength); if (pcidBuffer == NULL) { PRINT_ERR("malloc for pcid buffer failed\n"); + cJSON_Delete(jsonRootObj); return FreeAfterCreatePCID(NULL, allOsSyscapObj, contextBuffer, 0, -1); } (void)memset_s(pcidBuffer, pcidLength, 0, pcidLength); @@ -305,6 +308,7 @@ int32_t GetOsSyscap(PCIDMain *pcidMain, cJSON *sysCapObject) errno_t nRet = memcpy_s(osSyscap, OS_SYSCAP_BYTES, (uint8_t *)pcidMain + 8, OS_SYSCAP_BYTES); if (nRet != EOK) { PRINT_ERR("memcpy_s failed."); + cJSON_Delete(capVectorPtr); return -1; } @@ -361,10 +365,12 @@ int32_t GetPriSyscap(PCIDMain *pcidMain, cJSON *sysCapObject, size_t contextBufL int32_t ret = sprintf_s(fullCapStr, SINGLE_SYSCAP_LEN, "SystemCapability.%s", priSyscapStr); if (ret == -1) { printf("sprintf_s failed\n"); + cJSON_Delete(capVectorPtr); return -1; } if (!cJSON_AddItemToArray(capVectorPtr, cJSON_CreateString(fullCapStr))) { printf("cJSON_AddItemToArray or cJSON_CreateString failed\n"); + cJSON_Delete(capVectorPtr); return -1; } tempPriSyscapStr = priSyscapStr; @@ -643,6 +649,7 @@ static int32_t AddPriSyscapToJsonObj(char *priSyscapString, uint32_t priSyscapSt if (priSyscapStringLen == 0) { if (!cJSON_AddItemToObject(sysCapObj, "private", sysCapArray)) { PRINT_ERR("Add private syscap array to json failed.\n"); + cJSON_Delete(sysCapArray); free(sysCapArray); return -1; } @@ -653,6 +660,7 @@ static int32_t AddPriSyscapToJsonObj(char *priSyscapString, uint32_t priSyscapSt while (token != NULL) { if (!cJSON_AddItemToArray(sysCapArray, cJSON_CreateString(token))) { PRINT_ERR("Add private syscap string to json failed.\n"); + cJSON_Delete(sysCapArray); free(sysCapArray); return -1; } @@ -714,10 +722,11 @@ int32_t DecodeStringPCIDToJson(char *input, char *outDirPath) } ret = 0; - SAVE_FAILED: +SAVE_FAILED: free(jsonBuffer); - ADD_JSON_FAILED: +ADD_JSON_FAILED: cJSON_Delete(rootObj); + cJSON_Delete(sysCapObj); PARSE_FAILED: free(ctx); return ret; diff --git a/src/main.c b/src/main.c index 4cc9e42..47a7769 100644 --- a/src/main.c +++ b/src/main.c @@ -37,6 +37,7 @@ #define INPUT_FILE 8 #define OUTPUT_FILE 9 #define HELP 10 +#define INPUT_FILE_NUM 4 static void PrintHelp(void); static void PrintVersion(void); @@ -85,7 +86,7 @@ int main(int argc, char **argv) break; } if (flag == 'C') { - if (argc != 4 || optind < 0 || optind >= argc) { // 4, argc of ./syscap_tool -C f1 f2 + if (argc != INPUT_FILE_NUM || optind < 0 || optind >= argc) { // 4, argc of ./syscap_tool -C f1 f2 PRINT_ERR("Input file too few or too many.\n"); return -1; } @@ -126,7 +127,12 @@ int32_t OperateByBitMap(char *const *argv, uint16_t bitMap, char *outputpath) case 0x10E: // 0x10E, -Rdsi inputfile printf("-Rdsi is not support currently.\n"); break; case 0x80: // 0x80, -v - (void)OutputVersion(argv[optind], optind); break; + if (optind < 0 || optind >= INPUT_FILE_NUM) { + PRINT_ERR("Input file too few or too many.\n"); + return -1; + } else { + (void)OutputVersion(argv[optind], optind); break; + } default: (void)OutputHelp(); } -- Gitee From 9b2a5432d81c6ead4039a10115fb5f1287b99f8f Mon Sep 17 00:00:00 2001 From: lichao Date: Sun, 21 Apr 2024 18:21:55 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E5=AE=89=E5=85=A8=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lichao --- interfaces/inner_api/syscap_interface.c | 2 -- src/create_pcid.c | 12 +++++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/interfaces/inner_api/syscap_interface.c b/interfaces/inner_api/syscap_interface.c index d28800a..a4a342e 100644 --- a/interfaces/inner_api/syscap_interface.c +++ b/interfaces/inner_api/syscap_interface.c @@ -320,8 +320,6 @@ static int32_t ParseRpcidToJson(char *input, uint32_t inputLen, cJSON *rpcidJson ret = -1; goto FREE_SYSCAP_OUT; } - - return 0; FREE_SYSCAP_OUT: cJSON_Delete(sysCapJson); return ret; diff --git a/src/create_pcid.c b/src/create_pcid.c index 30cd37e..e8aac78 100644 --- a/src/create_pcid.c +++ b/src/create_pcid.c @@ -262,6 +262,7 @@ int32_t CreatePCID(char *inputFile, char *outDirPath) cJSON *jsonPriSyscapObj = cJSON_GetObjectItem(jsonSyscapObj, "private"); ret = GetOsAndPriSyscapSize(jsonOsSyscapObj, jsonPriSyscapObj, &osCapSize, &privateCapSize); if (ret != 0) { + cJSON_Delete(jsonRootObj); return FreeAfterCreatePCID(NULL, allOsSyscapObj, contextBuffer, 0, ret); } @@ -347,6 +348,11 @@ int32_t GetPriSyscap(PCIDMain *pcidMain, cJSON *sysCapObject, size_t contextBufL return -1; } + if (contextBufLen < 0 || contextBufLen > UINT32_MAX) { + PRINT_ERR("the data privateSyscapLen is out of scope."); + return -1; + } + int32_t privateSyscapLen = (int32_t)(contextBufLen - sizeof(PCIDMain) - 1); if (privateSyscapLen < 0) { PRINT_ERR("parse private syscap failed."); @@ -381,9 +387,9 @@ int32_t GetPriSyscap(PCIDMain *pcidMain, cJSON *sysCapObject, size_t contextBufL } if (!cJSON_AddItemToObject(sysCapObject, "private", capVectorPtr)) { PRINT_ERR("cJSON_AddItemToObject failed\n"); + cJSON_Delete(capVectorPtr); return -1; } - return 0; } @@ -653,6 +659,7 @@ static int32_t AddPriSyscapToJsonObj(char *priSyscapString, uint32_t priSyscapSt free(sysCapArray); return -1; } + cJSON_Delete(sysCapArray); return 0; } @@ -726,8 +733,7 @@ SAVE_FAILED: free(jsonBuffer); ADD_JSON_FAILED: cJSON_Delete(rootObj); - cJSON_Delete(sysCapObj); - PARSE_FAILED: +PARSE_FAILED: free(ctx); return ret; } -- Gitee From db92b45c81db68571d93fbcaea4bac9c1899de4c Mon Sep 17 00:00:00 2001 From: lichao Date: Sun, 21 Apr 2024 19:06:45 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E5=AE=89=E5=85=A8=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lichao --- src/create_pcid.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/create_pcid.c b/src/create_pcid.c index e8aac78..1a606df 100644 --- a/src/create_pcid.c +++ b/src/create_pcid.c @@ -358,6 +358,7 @@ int32_t GetPriSyscap(PCIDMain *pcidMain, cJSON *sysCapObject, size_t contextBufL PRINT_ERR("parse private syscap failed."); return -1; } else if (privateSyscapLen == 0) { + cJSON_Delete(capVectorPtr); return 0; } @@ -656,7 +657,6 @@ static int32_t AddPriSyscapToJsonObj(char *priSyscapString, uint32_t priSyscapSt if (!cJSON_AddItemToObject(sysCapObj, "private", sysCapArray)) { PRINT_ERR("Add private syscap array to json failed.\n"); cJSON_Delete(sysCapArray); - free(sysCapArray); return -1; } cJSON_Delete(sysCapArray); @@ -668,16 +668,16 @@ static int32_t AddPriSyscapToJsonObj(char *priSyscapString, uint32_t priSyscapSt if (!cJSON_AddItemToArray(sysCapArray, cJSON_CreateString(token))) { PRINT_ERR("Add private syscap string to json failed.\n"); cJSON_Delete(sysCapArray); - free(sysCapArray); return -1; } token = strtok(NULL, ","); } if (!cJSON_AddItemToObject(sysCapObj, "private", sysCapArray)) { PRINT_ERR("Add private syscap array to json failed.\n"); - free(sysCapArray); + cJSON_Delete(sysCapArray); return -1; } + cJSON_Delete(sysCapArray); return 0; } @@ -705,18 +705,22 @@ int32_t DecodeStringPCIDToJson(char *input, char *outDirPath) cJSON *rootObj = cJSON_CreateObject(); if (!cJSON_AddItemToObject(rootObj, "syscap", sysCapObj)) { PRINT_ERR("Add syscap to json failed.\n"); + cJSON_Delete(sysCapObj); goto ADD_JSON_FAILED; } if (AddHeaderToJsonObj(pcidHeader, PCID_HEADER, rootObj) != 0) { PRINT_ERR("Add header to json object failed.\n"); + cJSON_Delete(sysCapObj); goto ADD_JSON_FAILED; } if (AddOsSyscapToJsonObj(osSyscap, OS_SYSCAP_NUM, sysCapObj) != 0) { PRINT_ERR("Add os syscap json object failed.\n"); + cJSON_Delete(sysCapObj); goto ADD_JSON_FAILED; } if (AddPriSyscapToJsonObj(priSyscapStr, (uint32_t)strlen(priSyscapStr), sysCapObj) != 0) { PRINT_ERR("Add private syscap json object failed.\n"); + cJSON_Delete(sysCapObj); goto ADD_JSON_FAILED; } // save as json file @@ -767,18 +771,21 @@ static int32_t GetEncodePCIDOut(uint16_t priSyscapCount, uint32_t privateSyscapL output = (char *)malloc(outputLen); if (output == NULL) { PRINT_ERR("malloc failed\n"); + free(output); return FreeAfterEncodePCID(freePcidInfo, FREE_ENCODE_PCID_PRISYSCAP_FULL_OUT, ret); } (void)memset_s(output, outputLen, 0, outputLen); ret = sprintf_s(output, outputLen, "%u", mainSyscap[0]); if (ret == -1) { PRINT_ERR("sprintf_s failed\n"); + free(output); return FreeAfterEncodePCID(freePcidInfo, FREE_ENCODE_PCID_OUT, ret); } for (i = 1; i < PCID_OUT_BUFFER; i++) { ret = sprintf_s(output, outputLen, "%s,%u", output, mainSyscap[i]); if (ret == -1) { PRINT_ERR("sprintf_s failed\n"); + free(output); return FreeAfterEncodePCID(freePcidInfo, FREE_ENCODE_PCID_OUT, ret); } } @@ -786,6 +793,7 @@ static int32_t GetEncodePCIDOut(uint16_t priSyscapCount, uint32_t privateSyscapL ret = sprintf_s(output, outputLen, "%s,%s", output, freePcidInfo.priSyscapFull + i * SINGLE_SYSCAP_LEN); if (ret == -1) { PRINT_ERR("sprintf_s failed\n"); + free(output); return FreeAfterEncodePCID(freePcidInfo, FREE_ENCODE_PCID_OUT, ret); } } @@ -796,6 +804,7 @@ static int32_t GetEncodePCIDOut(uint16_t priSyscapCount, uint32_t privateSyscapL PRINT_ERR("ConvertedContextSaveAsFile failed, outDirPath:%s, filename:%s\n", freePcidInfo.outDirPathFinal, outputFileName); } + free(output); return FreeAfterEncodePCID(freePcidInfo, FREE_ENCODE_PCID_OUT, ret); } -- Gitee From d708c9cac6647df94443becfc6d49550434c46ac Mon Sep 17 00:00:00 2001 From: lichao Date: Sun, 21 Apr 2024 20:04:40 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E5=AE=89=E5=85=A8=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lichao --- interfaces/inner_api/syscap_interface.c | 8 +++++--- src/create_pcid.c | 3 +++ src/syscap_tool.c | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/interfaces/inner_api/syscap_interface.c b/interfaces/inner_api/syscap_interface.c index a4a342e..887d498 100644 --- a/interfaces/inner_api/syscap_interface.c +++ b/interfaces/inner_api/syscap_interface.c @@ -245,6 +245,7 @@ bool DecodePrivateSyscap(char *input, char (**output)[SINGLE_SYSCAP_LEN], int *o *bufferPos = '\0'; if (sprintf_s(*outputArray, SINGLE_SYSCAP_LEN, "SystemCapability.%s", buffer) == -1) { free(outputArray); + free(output); return false; } bufferPos = buffer; @@ -328,24 +329,25 @@ FREE_SYSCAP_OUT: static int32_t TransStringFormatAndSaveSyscap(struct FreeAfterDecodeRpcidInfo freeAfterDecodeRpcidInfo, cJSON *sysCapArray, const char *inputFile) { + int32_t ret = -1; // trans to string format sysCapArray = cJSON_GetObjectItem(freeAfterDecodeRpcidInfo.rpcidRoot, "syscap"); if (sysCapArray == NULL || !cJSON_IsArray(sysCapArray)) { PRINT_ERR("Get syscap failed. Input file: %s\n", inputFile); - return -1; + return ret; } freeAfterDecodeRpcidInfo.sysCapArraySize = cJSON_GetArraySize(sysCapArray); if (freeAfterDecodeRpcidInfo.sysCapArraySize < 0) { PRINT_ERR("Get syscap size failed. Input file: %s\n", inputFile); - return -1; + return ret; } // malloc for save os syscap index freeAfterDecodeRpcidInfo.osSysCapIndex = (uint16_t *)malloc(sizeof(uint16_t) * freeAfterDecodeRpcidInfo.sysCapArraySize); if (freeAfterDecodeRpcidInfo.osSysCapIndex == NULL) { PRINT_ERR("malloc failed.\n"); - return -1; } + free(freeAfterDecodeRpcidInfo.osSysCapIndex); return 0; } diff --git a/src/create_pcid.c b/src/create_pcid.c index 1a606df..da181d8 100644 --- a/src/create_pcid.c +++ b/src/create_pcid.c @@ -286,10 +286,12 @@ int32_t CreatePCID(char *inputFile, char *outDirPath) ret += SetPriSyscap(pcidBuffer, jsonPriSyscapObj, privateCapSize, allPriSyscapStrLen); ret += SetPCIDHeader(pcidBuffer, jsonRootObj); if (ret != 0) { + cJSON_Delete(jsonRootObj); return FreeAfterCreatePCID(pcidBuffer, allOsSyscapObj, contextBuffer, FREE_CREATE_PCID_BUFFER_OUT, ret); } ret = CheckConvertedContextSaveAsFile(outDirPath, pcidBuffer, pcidLength, ret); + cJSON_Delete(jsonRootObj); return FreeAfterCreatePCID(pcidBuffer, allOsSyscapObj, contextBuffer, FREE_CREATE_PCID_BUFFER_OUT, ret); } @@ -520,6 +522,7 @@ int32_t DecodePCID(char *inputFile, char *outDirPath) if (ret != 0) { PRINT_ERR("ConvertedContextSaveAsFile failed, outDirPath:%s, filename:%s\n", outDirPath, outputFileName); } + free(strJson); return FreeAfterDecodePCID(freePcidJsonInfo, FREE_DECODE_PCID_CONVERT_OUT, ret); } diff --git a/src/syscap_tool.c b/src/syscap_tool.c index ff4e084..b79c6b7 100644 --- a/src/syscap_tool.c +++ b/src/syscap_tool.c @@ -266,6 +266,7 @@ int32_t RPCIDDecode(char *inputFile, char *outputPath) FREE_RPCID_ROOT: cJSON_Delete(rpcidRoot); + free(convertedBuffer); FREE_CONTEXT_OUT: FreeContextBuffer(contextBuffer); return ret; -- Gitee From 2156d58edeaa83d156bb9e46734ab113029ac19e Mon Sep 17 00:00:00 2001 From: lichao Date: Sun, 21 Apr 2024 20:54:04 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E7=BC=96=E7=A0=81=E8=A7=84=E8=8C=83?= =?UTF-8?q?=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lichao --- interfaces/inner_api/syscap_interface.c | 29 +++++++++++++------------ 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/interfaces/inner_api/syscap_interface.c b/interfaces/inner_api/syscap_interface.c index 887d498..8b9749e 100644 --- a/interfaces/inner_api/syscap_interface.c +++ b/interfaces/inner_api/syscap_interface.c @@ -57,7 +57,7 @@ typedef struct ProductCompatibilityID { uint8_t osSyscap[OS_SYSCAP_BYTES]; } PCIDMain; -static const char *g_pcidPath = "/system/etc/PCID.sc"; +static const char *g_PCID_PATH = "/system/etc/PCID.sc"; struct FreeAfterDecodeRpcidInfo { char *priSyscap; @@ -89,7 +89,7 @@ bool EncodeOsSyscap(char *output, int len) return false; } - ret = GetFileContext(g_pcidPath, &contextBuffer, &bufferLen); + ret = GetFileContext(g_PCID_PATH, &contextBuffer, &bufferLen); if (ret != 0) { PRINT_ERR("GetFileContext failed, input file : /system/etc/PCID.sc\n"); return false; @@ -113,7 +113,7 @@ bool EncodePrivateSyscap(char **output, int *outputLen) char *outputStr = NULL; uint32_t bufferLen; - ret = GetFileContext(g_pcidPath, &contextBuffer, &bufferLen); + ret = GetFileContext(g_PCID_PATH, &contextBuffer, &bufferLen); if (ret != 0) { PRINT_ERR("GetFileContext failed, input file : /system/etc/PCID.sc\n"); return false; @@ -181,18 +181,19 @@ bool DecodeOsSyscap(const char input[PCID_MAIN_BYTES], char (**output)[SINGLE_SY for (i = 0; i < countOfSyscap; i++) { for (j = 0; j < sizeof(g_arraySyscap) / sizeof(SyscapWithNum); j++) { - if (g_arraySyscap[j].num == indexOfSyscap[i]) { - nRet = strcpy_s(*strSyscap, SINGLE_SYSCAP_LEN, g_arraySyscap[j].str); - if (nRet != EOK) { - printf("strcpy_s failed. error = %d\n", nRet); - *outputCnt = 0; - free(strSyscap); - strSyscap = NULL; - return false; - } - strSyscap++; - break; + if (g_arraySyscap[j].num != indexOfSyscap[i]) { + continue; + } + nRet = strcpy_s(*strSyscap, SINGLE_SYSCAP_LEN, g_arraySyscap[j].str); + if (nRet != EOK) { + printf("strcpy_s failed. error = %d\n", nRet); + *outputCnt = 0; + free(strSyscap); + strSyscap = NULL; + return false; } + strSyscap++; + break; } } -- Gitee From a622fe975fa5b8de5726537f622b3d4a0e33fc8a Mon Sep 17 00:00:00 2001 From: lichao Date: Mon, 22 Apr 2024 08:40:58 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E7=BC=96=E7=A0=81=E8=A7=84=E8=8C=83?= =?UTF-8?q?=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lichao --- interfaces/inner_api/syscap_interface.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/interfaces/inner_api/syscap_interface.c b/interfaces/inner_api/syscap_interface.c index 8b9749e..9e1dff5 100644 --- a/interfaces/inner_api/syscap_interface.c +++ b/interfaces/inner_api/syscap_interface.c @@ -57,7 +57,7 @@ typedef struct ProductCompatibilityID { uint8_t osSyscap[OS_SYSCAP_BYTES]; } PCIDMain; -static const char *g_PCID_PATH = "/system/etc/PCID.sc"; +static const char *PCID_PATH = "/system/etc/PCID.sc"; struct FreeAfterDecodeRpcidInfo { char *priSyscap; @@ -89,7 +89,7 @@ bool EncodeOsSyscap(char *output, int len) return false; } - ret = GetFileContext(g_PCID_PATH, &contextBuffer, &bufferLen); + ret = GetFileContext(PCID_PATH, &contextBuffer, &bufferLen); if (ret != 0) { PRINT_ERR("GetFileContext failed, input file : /system/etc/PCID.sc\n"); return false; @@ -113,7 +113,7 @@ bool EncodePrivateSyscap(char **output, int *outputLen) char *outputStr = NULL; uint32_t bufferLen; - ret = GetFileContext(g_PCID_PATH, &contextBuffer, &bufferLen); + ret = GetFileContext(PCID_PATH, &contextBuffer, &bufferLen); if (ret != 0) { PRINT_ERR("GetFileContext failed, input file : /system/etc/PCID.sc\n"); return false; -- Gitee