From 7f48ebf908f2ab30100baa8673cd773d90e07c97 Mon Sep 17 00:00:00 2001 From: xiacong Date: Thu, 24 Nov 2022 17:35:00 +0800 Subject: [PATCH] =?UTF-8?q?=20=E4=BF=AE=E5=A4=8Dcppcheck=E5=91=8A?= =?UTF-8?q?=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xiacong Change-Id: Ifd15ff9711cdb6f37ca65725e1c6c50869077246 --- services/modules/seccomp/seccomp_policy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/modules/seccomp/seccomp_policy.c b/services/modules/seccomp/seccomp_policy.c index 12bd90fa..1b25b0c8 100644 --- a/services/modules/seccomp/seccomp_policy.c +++ b/services/modules/seccomp/seccomp_policy.c @@ -86,7 +86,7 @@ static bool InstallSeccompPolicy(const struct sock_filter* filter, size_t filter static char *GetFilterFileByName(const char *filterName) { size_t maxFilterNameLen = PATH_MAX - strlen(FILTER_LIB_PATH_FORMAT) + strlen("%s") - 1; - if (filterName == NULL && strlen(filterName) > maxFilterNameLen) { + if (filterName == NULL || strlen(filterName) > maxFilterNameLen) { return NULL; } @@ -158,7 +158,7 @@ bool SetSeccompPolicyWithName(const char *filterName) { void *handler = NULL; char *filterLibRealPath = NULL; - struct sock_fprog prog = {0}; + struct sock_fprog prog; bool ret = false; filterLibRealPath = GetFilterFileByName(filterName); -- GitLab