未验证 提交 3ee87b1a 编写于 作者: O openharmony_ci 提交者: Gitee

!1563 fix seccomp模块 codex

Merge pull request !1563 from 夏不白/seccomp_warning
...@@ -61,6 +61,10 @@ static bool IsSupportFilterFlag(unsigned int filterFlag) ...@@ -61,6 +61,10 @@ static bool IsSupportFilterFlag(unsigned int filterFlag)
static bool InstallSeccompPolicy(const struct sock_filter* filter, size_t filterSize, unsigned int filterFlag) static bool InstallSeccompPolicy(const struct sock_filter* filter, size_t filterSize, unsigned int filterFlag)
{ {
if (filter == NULL) {
return false;
}
unsigned int flag = 0; unsigned int flag = 0;
struct sock_fprog prog = { struct sock_fprog prog = {
(unsigned short)filterSize, (unsigned short)filterSize,
...@@ -105,6 +109,11 @@ static char *GetFilterFileByName(const char *filterName) ...@@ -105,6 +109,11 @@ static char *GetFilterFileByName(const char *filterName)
static int GetSeccompPolicy(const char *filterName, int **handler, static int GetSeccompPolicy(const char *filterName, int **handler,
char *filterLibRealPath, struct sock_fprog *prog) char *filterLibRealPath, struct sock_fprog *prog)
{ {
if (filterName == NULL || filterLibRealPath == NULL || \
handler == NULL || prog == NULL) {
return INPUT_ERROR;
}
char filterVaribleName[PATH_MAX] = {0}; char filterVaribleName[PATH_MAX] = {0};
struct sock_filter *filter = NULL; struct sock_filter *filter = NULL;
size_t *filterSize = NULL; size_t *filterSize = NULL;
...@@ -156,6 +165,10 @@ static int GetSeccompPolicy(const char *filterName, int **handler, ...@@ -156,6 +165,10 @@ static int GetSeccompPolicy(const char *filterName, int **handler,
bool SetSeccompPolicyWithName(const char *filterName) bool SetSeccompPolicyWithName(const char *filterName)
{ {
if (filterName == NULL) {
return false;
}
void *handler = NULL; void *handler = NULL;
char *filterLibRealPath = NULL; char *filterLibRealPath = NULL;
struct sock_fprog prog; struct sock_fprog prog;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册