setting parameters must be integer

This commit is contained in:
shixuantong 2024-08-30 15:15:07 +08:00
parent 1bf01ab334
commit 41227a522f
3 changed files with 70 additions and 1 deletions

View File

@ -0,0 +1,23 @@
From 34febf57060060d1f8262941af49e3beeb1f7f5d Mon Sep 17 00:00:00 2001
From: jwolf <523083921@qq.com>
Date: Fri, 30 Aug 2024 16:59:56 +0800
Subject: [PATCH] param must be integer
---
src/c/catcli/catlib/cli_param_checker.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/c/catcli/catlib/cli_param_checker.c b/src/c/catcli/catlib/cli_param_checker.c
index 5b38402..71edf17 100644
--- a/src/c/catcli/catlib/cli_param_checker.c
+++ b/src/c/catcli/catlib/cli_param_checker.c
@@ -17,6 +17,7 @@ void checkset_cpu_usage_percentage(char *getopt_optarg, catcli_request_body *p_r
if (cpu_utility <= 0 || cpu_utility > CPU_USAGE_PERCENTAGE_MAX || strchr(getopt_optarg, '.') != NULL) {
strncpy(errs->patrol_module_err,
"\"cpu_utility \" must be an integer greater in the range (0,100],correct \"-u, --cpu_utility\"\n", MAX_ERR_LEN);
+ p_request_body->cpu_utility = 0;
} else {
p_request_body->cpu_utility = (int)cpu_utility;
}
--
Gitee

View File

@ -0,0 +1,38 @@
From 4abad77067557234d938de3914094c80181030c1 Mon Sep 17 00:00:00 2001
From: jwolf <523083921@qq.com>
Date: Fri, 30 Aug 2024 14:30:46 +0800
Subject: [PATCH] must be integer
---
c/catcli/catlib/cli_param_checker.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/c/catcli/catlib/cli_param_checker.c b/src/c/catcli/catlib/cli_param_checker.c
index e400428..5b38402 100644
--- a/src/c/catcli/catlib/cli_param_checker.c
+++ b/src/c/catcli/catlib/cli_param_checker.c
@@ -17,8 +17,9 @@ void checkset_cpu_usage_percentage(char *getopt_optarg, catcli_request_body *p_r
if (cpu_utility <= 0 || cpu_utility > CPU_USAGE_PERCENTAGE_MAX || strchr(getopt_optarg, '.') != NULL) {
strncpy(errs->patrol_module_err,
"\"cpu_utility \" must be an integer greater in the range (0,100],correct \"-u, --cpu_utility\"\n", MAX_ERR_LEN);
+ } else {
+ p_request_body->cpu_utility = (int)cpu_utility;
}
- p_request_body->cpu_utility = (int)cpu_utility;
}
void checkset_cpulist(char *getopt_optarg, catcli_request_body *p_request_body, struct option_errs *errs)
@@ -73,8 +74,9 @@ void checkset_patrol_time(char *getopt_optarg, catcli_request_body *p_request_bo
strncpy(errs->patrol_time_err,
"\"patrol_second\" must be a number in the range of (0,INT_MAX] ,correct \"-t, --patrol_second\"\n",
MAX_ERR_LEN);
+ } else {
+ p_request_body->patrol_second = (int)second;
}
- p_request_body->patrol_second = (int)second;
}
void checkset_patrol_type(char *getopt_optarg, catcli_request_body *p_request_body, struct option_errs *errs)
--
2.27.0

View File

@ -4,7 +4,7 @@
Summary: System Inspection Framework
Name: sysSentry
Version: 1.0.2
Release: 5
Release: 6
License: Mulan PSL v2
Group: System Environment/Daemons
Source0: https://gitee.com/openeuler/sysSentry/releases/download/v%{version}/%{name}-%{version}.tar.gz
@ -15,6 +15,8 @@ Patch2: Fix-the-problem-that-function-cpu_report_result-is-c.patch
Patch3: fix-error-handling.patch
Patch4: fix-result-when-process-output-is-None.patch
Patch5: cpu_utility-and-cpu_patrol-must-be-an-integer.patch
Patch6: setting-parameters-must-be-integer.patch
Patch7: param-must-be-integer.patch
BuildRequires: cmake gcc-c++
BuildRequires: python3 python3-setuptools
@ -171,6 +173,12 @@ rm -rf %{buildroot}
%attr(0550,root,root) %{python3_sitelib}/syssentry/cpu_*
%changelog
* Fri Aug 30 2024 shixuantong <shixuantong1@huawei.com> - 1.0.2-6
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:setting parameters must be integer
* Wed Aug 28 2024 shixuantong <shixuantong1@huawei.com> - 1.0.2-5
- Type:bugfix
- CVE:NA