mirror of
https://github.com/openharmony/developtools_syscap_codec.git
synced 2026-08-27 02:11:19 -04:00
修改src/syscap_tool.c文件,消除主干代码安全告警
优化502行指针变量空判断代码,消除主干代码可能潜在的内存资源泄漏告警 Signed-off-by: tongkai0808fh <tongkai5@huawei.com>
This commit is contained in:
+7
-2
@@ -499,10 +499,15 @@ int32_t EncodeRpcidscToString(char *inputFile, char *outDirPath)
|
||||
|
||||
char *CopyInputString(const char *inputString)
|
||||
{
|
||||
if (inputString == NULL || *inputString == '\0') {
|
||||
PRINT_ERR("inputString is null or empty.\n");
|
||||
if (inputString == NULL) {
|
||||
PRINT_ERR("inputString is null.\n");
|
||||
return NULL;
|
||||
}
|
||||
if (*inputString == '\0') {
|
||||
PRINT_ERR("inputString is empty.\n");
|
||||
inputString == NULL;
|
||||
return NULL;
|
||||
}}
|
||||
size_t inputLen = strlen(inputString);
|
||||
if (inputLen > STRING_FORMAT_LEN_MAX) {
|
||||
PRINT_ERR("input string too long(%zu).\n", inputLen);
|
||||
|
||||
Reference in New Issue
Block a user