cpu_utility and cpu_patrol must be an integer
This commit is contained in:
parent
5561d427a4
commit
aed04f32d3
41
cpu_utility-and-cpu_patrol-must-be-an-integer.patch
Normal file
41
cpu_utility-and-cpu_patrol-must-be-an-integer.patch
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
From 6e98b2e5008ffabfda8d1c10778717f972b54398 Mon Sep 17 00:00:00 2001
|
||||||
|
From: jwolf <523083921@qq.com>
|
||||||
|
Date: Mon, 22 Jul 2024 14:58:27 +0800
|
||||||
|
Subject: [PATCH] cpu_utility and cpu_patrol musht be an integer
|
||||||
|
|
||||||
|
---
|
||||||
|
src/c/catcli/catlib/cli_param_checker.c | 5 +++--
|
||||||
|
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/c/catcli/catlib/cli_param_checker.c b/src/c/catcli/catlib/cli_param_checker.c
|
||||||
|
index a1aa636..e400428 100644
|
||||||
|
--- a/src/c/catcli/catlib/cli_param_checker.c
|
||||||
|
+++ b/src/c/catcli/catlib/cli_param_checker.c
|
||||||
|
@@ -2,6 +2,7 @@
|
||||||
|
#include <sys/un.h>
|
||||||
|
#include <regex.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
+#include <string.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include "cli_common.h"
|
||||||
|
@@ -13,7 +14,7 @@
|
||||||
|
void checkset_cpu_usage_percentage(char *getopt_optarg, catcli_request_body *p_request_body, struct option_errs *errs)
|
||||||
|
{
|
||||||
|
long cpu_utility = strtol(getopt_optarg, NULL, DECIMAL);
|
||||||
|
- if (cpu_utility <= 0 || cpu_utility > CPU_USAGE_PERCENTAGE_MAX) {
|
||||||
|
+ 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);
|
||||||
|
}
|
||||||
|
@@ -68,7 +69,7 @@ void checkset_cpulist(char *getopt_optarg, catcli_request_body *p_request_body,
|
||||||
|
void checkset_patrol_time(char *getopt_optarg, catcli_request_body *p_request_body, struct option_errs *errs)
|
||||||
|
{
|
||||||
|
long second = strtol(getopt_optarg, NULL, DECIMAL);
|
||||||
|
- if (second <= 0 || second > INT_MAX) {
|
||||||
|
+ if (second <= 0 || second > INT_MAX || strchr(getopt_optarg, '.') != NULL) {
|
||||||
|
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);
|
||||||
|
--
|
||||||
|
Gitee
|
||||||
@ -4,7 +4,7 @@
|
|||||||
Summary: System Inspection Framework
|
Summary: System Inspection Framework
|
||||||
Name: sysSentry
|
Name: sysSentry
|
||||||
Version: 1.0.2
|
Version: 1.0.2
|
||||||
Release: 4
|
Release: 5
|
||||||
License: Mulan PSL v2
|
License: Mulan PSL v2
|
||||||
Group: System Environment/Daemons
|
Group: System Environment/Daemons
|
||||||
Source0: https://gitee.com/openeuler/sysSentry/releases/download/v%{version}/%{name}-%{version}.tar.gz
|
Source0: https://gitee.com/openeuler/sysSentry/releases/download/v%{version}/%{name}-%{version}.tar.gz
|
||||||
@ -14,6 +14,7 @@ Patch1: fix-version-in-setup.py.patch
|
|||||||
Patch2: Fix-the-problem-that-function-cpu_report_result-is-c.patch
|
Patch2: Fix-the-problem-that-function-cpu_report_result-is-c.patch
|
||||||
Patch3: fix-error-handling.patch
|
Patch3: fix-error-handling.patch
|
||||||
Patch4: fix-result-when-process-output-is-None.patch
|
Patch4: fix-result-when-process-output-is-None.patch
|
||||||
|
Patch5: cpu_utility-and-cpu_patrol-must-be-an-integer.patch
|
||||||
|
|
||||||
BuildRequires: cmake gcc-c++
|
BuildRequires: cmake gcc-c++
|
||||||
BuildRequires: python3 python3-setuptools
|
BuildRequires: python3 python3-setuptools
|
||||||
@ -170,6 +171,12 @@ rm -rf %{buildroot}
|
|||||||
%attr(0550,root,root) %{python3_sitelib}/syssentry/cpu_*
|
%attr(0550,root,root) %{python3_sitelib}/syssentry/cpu_*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Aug 28 2024 shixuantong <shixuantong1@huawei.com> - 1.0.2-5
|
||||||
|
- Type:bugfix
|
||||||
|
- CVE:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:cpu_utility and cpu_patrol must be an integer
|
||||||
|
|
||||||
* Fri Jul 26 2024 shixuantong <shixuantong1@huawei.com> - 1.0.2-4
|
* Fri Jul 26 2024 shixuantong <shixuantong1@huawei.com> - 1.0.2-4
|
||||||
- Type:bugfix
|
- Type:bugfix
|
||||||
- CVE:NA
|
- CVE:NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user