Fix issues with Werror format security
(cherry picked from commit 837491234bcabec8b54bbdeba2b58e09ace0e530)
This commit is contained in:
parent
01b6f01cfd
commit
3fe56a576f
43
Fix-issues-with-Werror-format-security.patch
Normal file
43
Fix-issues-with-Werror-format-security.patch
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
From 455daf357da7f394763e5b93b11b3defe1f82ed1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: kretcheu <kretcheu@gmail.com>
|
||||||
|
Date: Sat, 9 Oct 2021 16:37:10 -0300
|
||||||
|
Subject: [PATCH] Fix compilation error with [-Werror=format-security]
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
When compiling with [-Werror=format-security] in Debian packaging occurs this error:
|
||||||
|
```
|
||||||
|
cui.cpp: In function ‘void show_ncurses(Line**, int)’:
|
||||||
|
cui.cpp:377:73: error: format not a string literal and no format arguments [-Werror=format-security]
|
||||||
|
377 | mvprintw(3 + 1 + i, cols - COLUMN_WIDTH_UNIT, desc_view_mode[viewMode]);
|
||||||
|
| ^
|
||||||
|
cui.cpp:379:29: warning: zero-length gnu_printf format string [-Wformat-zero-length]
|
||||||
|
379 | mvprintw(totalrow + 1, 0, "");
|
||||||
|
| ^~
|
||||||
|
```
|
||||||
|
|
||||||
|
This patch solve the problem.
|
||||||
|
|
||||||
|
[]'s
|
||||||
|
kretcheu
|
||||||
|
---
|
||||||
|
src/cui.cpp | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/cui.cpp b/src/cui.cpp
|
||||||
|
index 96df1a2..d8cb05b 100644
|
||||||
|
--- a/src/cui.cpp
|
||||||
|
+++ b/src/cui.cpp
|
||||||
|
@@ -374,9 +374,9 @@ void show_ncurses(Line *lines[], int nproc) {
|
||||||
|
int totalrow = std::min(rows - 1, 3 + 1 + i);
|
||||||
|
mvprintw(totalrow, 0, " TOTAL %-*.*s %-*.*s %11.3f %11.3f ",
|
||||||
|
proglen, proglen, "", devlen, devlen, "", sent_global, recv_global);
|
||||||
|
- mvprintw(3 + 1 + i, cols - COLUMN_WIDTH_UNIT, desc_view_mode[viewMode]);
|
||||||
|
+ mvprintw(3 + 1 + i, cols - COLUMN_WIDTH_UNIT, "%s", desc_view_mode[viewMode]);
|
||||||
|
attroff(A_REVERSE);
|
||||||
|
- mvprintw(totalrow + 1, 0, "");
|
||||||
|
+ mvprintw(totalrow + 1, 0, "%s", "");
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
|
||||||
@ -1,10 +1,11 @@
|
|||||||
Name: nethogs
|
Name: nethogs
|
||||||
Version: 0.8.6
|
Version: 0.8.6
|
||||||
Release: 3
|
Release: 4
|
||||||
Summary: Nethogs is a small 'net top' tool
|
Summary: Nethogs is a small 'net top' tool
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
URL: https://github.com/raboof/nethogs/
|
URL: https://github.com/raboof/nethogs/
|
||||||
Source0: https://github.com/raboof/nethogs/archive/v%{version}.tar.gz
|
Source0: https://github.com/raboof/nethogs/archive/v%{version}.tar.gz
|
||||||
|
Patch0: Fix-issues-with-Werror-format-security.patch
|
||||||
|
|
||||||
BuildRequires: gcc-c++ libpcap-devel ncurses-devel
|
BuildRequires: gcc-c++ libpcap-devel ncurses-devel
|
||||||
|
|
||||||
@ -35,6 +36,9 @@ export CXXFLAGS="${CXXFLAGS} -fPIE -pie"
|
|||||||
%{_mandir}/../../local/share/man/man8/nethogs.8*
|
%{_mandir}/../../local/share/man/man8/nethogs.8*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Aug 28 2023 liyanan <thistleslyn@163.com> - 0.8.6-4
|
||||||
|
- Fix issues with Werror format security
|
||||||
|
|
||||||
* Mon Jun 05 2023 chenchen <chen_aka_jan@163.com> - 0.8.6-3
|
* Mon Jun 05 2023 chenchen <chen_aka_jan@163.com> - 0.8.6-3
|
||||||
- add PIE compiler options
|
- add PIE compiler options
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user