diff --git a/src/create_pcid.c b/src/create_pcid.c index 64814f3534ccf058debc137375b6e2a8a1178a13..4972ac92879591ab66fb310e38c6c5751389d63f 100644 --- a/src/create_pcid.c +++ b/src/create_pcid.c @@ -112,7 +112,12 @@ int32_t SetPriSyscap(PCIDMain *pcidBuffer, cJSON *jsonPriSyscapObj, PRINT_ERR("get jsonArrayItem failed!"); return -1; } - priSyscapStr = strchr(jsonArrayItem->valuestring, '.') + 1; + priSyscapStr = strchr(jsonArrayItem->valuestring, '.'); + if (priSyscapStr == NULL) { + PRINT_ERR("get priSyscapStr failed!"); + return -1; + } + priSyscapStr += 1; errno_t nRet = strcat_s(priSyscapHead, allPriSyscapStrLen + 1, priSyscapStr); nRet += strcat_s(priSyscapHead, allPriSyscapStrLen + 1, ","); if (nRet != EOK) { diff --git a/src/main.c b/src/main.c index 14879e3eff537278762fda436af48d17df6e4371..2fd051acf58588d0dcae63968ab877a31e0219e4 100644 --- a/src/main.c +++ b/src/main.c @@ -78,6 +78,10 @@ int main(int argc, char **argv) g_customerfileinfo.pcidfile = NULL; g_customerfileinfo.rpcidfile = NULL; char *outputpath = getcwd(curpath, sizeof(curpath)); + if (outputpath == NULL) { + PRINT_ERR("Get outputpath failed.\n"); + return -1; + } while (1) { int32_t flag = getopt_long(argc, argv, "hvRPC:edsi:o:", g_longOptions, &optIndex);