Fix variable substitution in conditional lines

Resolves: #2101493
This commit is contained in:
Ryan O'Hara 2022-12-22 20:28:35 -06:00
parent baf019f32b
commit 2625fb0d5e
2 changed files with 38 additions and 1 deletions

View File

@ -0,0 +1,32 @@
From 332262ec91f85cd4224816d2803d818015239007 Mon Sep 17 00:00:00 2001
From: Quentin Armitage <quentin@armitage.org.uk>
Date: Wed, 29 Jun 2022 09:18:15 +0100
Subject: [PATCH] parser: optimise fixing recalculating updated line length
Commit 1ffad9a - "recalculate buffer length inside recheck loop"
resolved the issue but calls strlen(buf) more often than necessary.
This commit only calls strlen(buf) when the line buffer is modified.
Signed-off-by: Quentin Armitage <quentin@armitage.org.uk>
---
lib/parser.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/parser.c b/lib/parser.c
index bcabd07f..2146f38b 100644
--- a/lib/parser.c
+++ b/lib/parser.c
@@ -2809,6 +2809,9 @@ read_line(char *buf, size_t size)
recheck = true;
if (strchr(buf, '$'))
recheck = true;
+
+ if (recheck)
+ len = strlen(buf);
}
} while (recheck);
} while (buf[0] == '\0' || check_include(buf));
--
2.38.1

View File

@ -11,7 +11,7 @@
Name: keepalived
Summary: High Availability monitor built upon LVS, VRRP and service pollers
Version: 2.2.4
Release: 3%{?dist}
Release: 4%{?dist}
License: GPLv2+
URL: http://www.keepalived.org/
@ -19,6 +19,7 @@ Source0: http://www.keepalived.org/software/keepalived-%{version}.tar.gz
Source1: keepalived.service
Patch1: bz2028351-fix-dbus-policy-restrictions.patch
Patch2: bz2102493-fix-variable-substitution.patch
Requires(post): systemd
Requires(preun): systemd
@ -60,6 +61,7 @@ infrastructures.
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%build
%configure \
@ -110,6 +112,9 @@ mkdir -p %{buildroot}%{_libexecdir}/keepalived
%{_mandir}/man8/keepalived.8*
%changelog
* Thu Dec 22 2022 Ryan O'Hara <rohara@redhat.com> - 2.2.4-4
- Fix variable substitution in consditional lines (#2101493)
* Thu Dec 22 2022 Ryan O'Hara <rohara@redhat.com> - 2.2.4-3
- Enable JSON support (#2129819)