!27 update some patches from community
From: @chengyechun Reviewed-by: @seuzw Signed-off-by: @seuzw
This commit is contained in:
commit
92e37519cc
@ -0,0 +1,71 @@
|
||||
From 356771c0c3c2b8040ba2ae83394460d1402d487b Mon Sep 17 00:00:00 2001
|
||||
From: Miroslav Lichvar <mlichvar@redhat.com>
|
||||
Date: Wed, 4 May 2022 20:17:23 GMT+8
|
||||
Subject: [PATCH] rework command and limit the length of command
|
||||
|
||||
Conflict:NA
|
||||
Reference:https://github.com/mlichvar/chrony/commit/356771c0c3c2b8040ba2ae83394460d1402d487b
|
||||
|
||||
---
|
||||
client.c | 35 ++++++++++++++---------------------
|
||||
1 file changed, 14 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/client.c b/client.c
|
||||
index cc179c6..863906a 100644
|
||||
--- a/client.c
|
||||
+++ b/client.c
|
||||
@@ -3409,37 +3409,30 @@ process_line(char *line)
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
+#define MAX_LINE_LENGTH 2048
|
||||
+
|
||||
static int
|
||||
process_args(int argc, char **argv, int multi)
|
||||
{
|
||||
- int total_length, i, ret = 0;
|
||||
- char *line;
|
||||
-
|
||||
- total_length = 0;
|
||||
- for(i=0; i<argc; i++) {
|
||||
- total_length += strlen(argv[i]) + 1;
|
||||
- }
|
||||
-
|
||||
- line = (char *) Malloc((2 + total_length) * sizeof(char));
|
||||
+ char line[MAX_LINE_LENGTH];
|
||||
+ int i, l, ret = 0;
|
||||
|
||||
- for (i = 0; i < argc; i++) {
|
||||
- line[0] = '\0';
|
||||
- if (multi) {
|
||||
- strcat(line, argv[i]);
|
||||
- } else {
|
||||
- for (; i < argc; i++) {
|
||||
- strcat(line, argv[i]);
|
||||
- if (i + 1 < argc)
|
||||
- strcat(line, " ");
|
||||
- }
|
||||
+ for (i = l = 0; i < argc; i++) {
|
||||
+ l += snprintf(line + l, sizeof(line) - l, "%s ", argv[i]);
|
||||
+ if (l >= sizeof(line)) {
|
||||
+ LOG(LOGS_ERR, "Command too long");
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
+ if (!multi && i + 1 < argc)
|
||||
+ continue;
|
||||
+
|
||||
ret = process_line(line);
|
||||
if (!ret || quit)
|
||||
break;
|
||||
- }
|
||||
|
||||
- Free(line);
|
||||
+ l = 0;
|
||||
+ }
|
||||
|
||||
return ret;
|
||||
}
|
||||
--
|
||||
2.23.0
|
||||
|
||||
12
chrony.spec
12
chrony.spec
@ -2,7 +2,7 @@
|
||||
|
||||
Name: chrony
|
||||
Version: 4.1
|
||||
Release: 1
|
||||
Release: 2
|
||||
Summary: An NTP client/server
|
||||
License: GPLv2
|
||||
URL: https://chrony.tuxfamily.org
|
||||
@ -12,6 +12,9 @@ Source1: chrony.dhclient
|
||||
Source6: https://github.com/mlichvar/clknetsim/archive/%{clknetsim_ver}/clknetsim-%{clknetsim_ver}.tar.gz
|
||||
|
||||
Patch1: chrony-nm-dispatcher-dhcp.patch
|
||||
|
||||
Patch6000: backport-rework-command-and-limit-the-length-of-command.patch
|
||||
|
||||
BuildRequires: gcc gcc-c++ bison systemd libcap-devel libedit-devel nettle-devel pps-tools-devel libseccomp-devel
|
||||
|
||||
Requires: shadow-utils systemd timedatex
|
||||
@ -29,6 +32,7 @@ service to other computers in the network.
|
||||
|
||||
%setup -q -n %{name}-%{version} -a 6
|
||||
%patch1 -p1
|
||||
%patch6000 -p1
|
||||
mv clknetsim-%{clknetsim_ver}* test/simulation/clknetsim
|
||||
|
||||
%build
|
||||
@ -135,6 +139,12 @@ fi
|
||||
%{_mandir}/man[158]/%{name}*.[158]*
|
||||
|
||||
%changelog
|
||||
* Tue Oct 18 2022 chengyechun <chengyechun1@huawei.com> - 4.1-2
|
||||
- Type:bugfix
|
||||
- Id:NA
|
||||
- SUG:NA
|
||||
- DESC:client rework command and limit the length of command
|
||||
|
||||
* Fri Jul 09 2021 gaihuiying <gaihuiying1@huawei.com> - 4.1-1
|
||||
- Type:requirement
|
||||
- Id:NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user