Fix traffic_top build when using -Werror=format-security

This commit is contained in:
wu-leilei 2022-05-09 11:34:07 +08:00
parent 95ed6ac2ff
commit 01ae06ae43
2 changed files with 42 additions and 2 deletions

View File

@ -0,0 +1,35 @@
From 7a93f208f32889ca5eb285dda87a4912fa30886a Mon Sep 17 00:00:00 2001
From: Jean-Baptiste Favre <jean-baptiste.favre@blablacar.com>
Date: Tue, 19 Oct 2021 08:42:04 +0200
Subject: [PATCH] Fix traffic_top build when using -Werror=format-security
Reference: https://github.com/apache/trafficserver/pull/8437
---
src/traffic_top/traffic_top.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/traffic_top/traffic_top.cc b/src/traffic_top/traffic_top.cc
index d33d682..2ac6b2a 100644
--- a/src/traffic_top/traffic_top.cc
+++ b/src/traffic_top/traffic_top.cc
@@ -126,7 +126,7 @@ prettyPrint(const int x, const int y, const double number, const int type)
}
attron(COLOR_PAIR(color));
attron(A_BOLD);
- mvprintw(y, x, buffer);
+ mvprintw(y, x, "%s", buffer);
attroff(COLOR_PAIR(color));
attroff(A_BOLD);
}
@@ -143,7 +143,7 @@ makeTable(const int x, const int y, const list<string> &items, Stats &stats)
int type;
stats.getStat(item, value, prettyName, type);
- mvprintw(my_y, x, prettyName.c_str());
+ mvprintw(my_y, x, "%s", prettyName.c_str());
prettyPrint(x + 10, my_y++, value, type);
}
}
--
2.27.0

View File

@ -2,7 +2,7 @@
%{!?release: %define release 2}
Name: trafficserver
Version: 9.1.0
Release: 4
Release: 5
Summary: Apache Traffic Server, a reverse, forward and transparent HTTP proxy cache
License: Apache-2.0
URL: https://trafficserver.apache.org/
@ -13,7 +13,8 @@ Patch0002: CVE-2021-37149.patch
Patch0003: CVE-2021-41585.patch
Patch0004: CVE-2021-43082.patch
Patch0005: Fix-status-failure-after-stopping-service.patch
Patch0006: Fix-log-in-debug-mode.patch
Patch0006: Fix-log-in-debug-mode.patch
Patch0007: Fix-traffic_top-build-when-using-Werror-format-security.patch
BuildRequires: expat-devel hwloc-devel openssl-devel pcre-devel zlib-devel xz-devel
BuildRequires: libcurl-devel ncurses-devel gcc gcc-c++ perl-ExtUtils-MakeMaker
BuildRequires: libcap-devel cmake libunwind-devel automake
@ -40,6 +41,7 @@ This package contains some Perl APIs for talking to the ATS management port.
%autosetup -n %{name}-%{version} -p1
%build
autoreconf
%configure \
--enable-layout=Gentoo \
--libdir=%{_libdir}/trafficserver \
@ -117,6 +119,9 @@ getent passwd ats >/dev/null || useradd -r -u 176 -g ats -d / -s /sbin/nologin -
%{_datadir}/pkgconfig/trafficserver.pc
%changelog
* Mon May 09 2022 wulei <wulei80@h-partners.com> - 9.1.0-5
- Fix traffic_top build when using -Werror=format-security
* Sat Nov 13 2021 caodongxia <caodongxia@huawei.com> - 9.1.0-4
- fix log in debug mode