!1643 feat:安全告警清理

Merge pull request !1643 from maliang/master
This commit is contained in:
openharmony_ci 2024-11-05 13:31:50 +00:00 committed by Gitee
commit 0813aaaf94
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 3 additions and 3 deletions

View File

@ -133,7 +133,7 @@ static void SetSelinuxLabel(bool isRoot)
WRITE_LOG(LOG_WARN, "SetSelinuxLabel isRoot:%d", isRoot);
return;
}
if ((strcmp(con, "u:r:hdcd:s0") != 0) && (strcmp(con, "u:r:updater:s0") != 0)) {
if ((con != nullptr) && (strcmp(con, "u:r:hdcd:s0") != 0) && (strcmp(con, "u:r:updater:s0") != 0)) {
WRITE_LOG(LOG_WARN, "SetSelinuxLabel con:%s isRoot:%d", con, isRoot);
freecon(con);
return;

View File

@ -161,7 +161,7 @@ static void SetSelinuxLabel()
if (getcon(&con) != 0) {
return;
}
if ((strcmp(con, "u:r:hdcd:s0") != 0) && (strcmp(con, "u:r:updater:s0") != 0)) {
if ((con != nullptr) && (strcmp(con, "u:r:hdcd:s0") != 0) && (strcmp(con, "u:r:updater:s0") != 0)) {
freecon(con);
return;
}

View File

@ -135,7 +135,7 @@ static bool GetCmdInPath(char *cmd, int cmdBufLen, char *envp[])
path = cp + 1;
} while (cp != nullptr);
free(pathBak);
delete [] pathBak;
if (!findSuccess) {
WriteTty(COMMAND_NOT_FOUND);
return false;