commit: 9f1e7cf1d1dd3441285b469c7bc71097d0990a27 Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Wed Feb 12 15:28:18 2025 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Wed Feb 12 15:44:59 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9f1e7cf1
net-analyzer/pinger: fix Modern C issue and -Wformat-security Closes: https://bugs.gentoo.org/944034 Signed-off-by: Sam James <sam <AT> gentoo.org> ...ger-0.33-interface_ncurses-fix-C23-compat.patch | 39 ++++++++++++++ ...33-interface_ncurses-fix-Wformat-security.patch | 60 ++++++++++++++++++++++ ...pinger-0.33-r1.ebuild => pinger-0.33-r2.ebuild} | 4 +- 3 files changed, 102 insertions(+), 1 deletion(-) diff --git a/net-analyzer/pinger/files/pinger-0.33-interface_ncurses-fix-C23-compat.patch b/net-analyzer/pinger/files/pinger-0.33-interface_ncurses-fix-C23-compat.patch new file mode 100644 index 000000000000..41ae74b87a9c --- /dev/null +++ b/net-analyzer/pinger/files/pinger-0.33-interface_ncurses-fix-C23-compat.patch @@ -0,0 +1,39 @@ +From a6392be483562043f9e06273a2b1e34b64b5eb13 Mon Sep 17 00:00:00 2001 +From: Sam James <[email protected]> +Date: Wed, 12 Feb 2025 15:24:41 +0000 +Subject: [PATCH 1/2] interface_ncurses: fix C23 compat + +adjust_size is called as a signal handler so needs to take an int param; +just define one and throw it away. + +Bug: https://bugs.gentoo.org/944034 +Signed-off-by: Sam James <[email protected]> +--- + src/interface_ncurses.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/interface_ncurses.c b/src/interface_ncurses.c +index f3ffc53..28d2ce5 100644 +--- a/src/interface_ncurses.c ++++ b/src/interface_ncurses.c +@@ -23,7 +23,7 @@ int new_cols, new_rows; + #endif + + #if CAN_RESIZE +-void adjust_size(); ++void adjust_size(int); + int size_changed = 0; + #endif + +@@ -519,7 +519,7 @@ void ncurses_gui_loop(hosts_data * hosts, int *stop_loop) + + /* Resize terminal if necessary */ + #if CAN_RESIZE +-void adjust_size() ++void adjust_size(int unused) + { + struct winsize size; + +-- +2.48.1 + diff --git a/net-analyzer/pinger/files/pinger-0.33-interface_ncurses-fix-Wformat-security.patch b/net-analyzer/pinger/files/pinger-0.33-interface_ncurses-fix-Wformat-security.patch new file mode 100644 index 000000000000..5586ac0308a1 --- /dev/null +++ b/net-analyzer/pinger/files/pinger-0.33-interface_ncurses-fix-Wformat-security.patch @@ -0,0 +1,60 @@ +From d464aa2a165adcf42c37d87e38ea3796ee56d485 Mon Sep 17 00:00:00 2001 +From: Sam James <[email protected]> +Date: Wed, 12 Feb 2025 15:25:15 +0000 +Subject: [PATCH 2/2] interface_ncurses: fix -Wformat-security + +Newer ncurses has format attributes which trigger this. + +Signed-off-by: Sam James <[email protected]> +--- + src/interface_ncurses.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/interface_ncurses.c b/src/interface_ncurses.c +index 28d2ce5..a7496d2 100644 +--- a/src/interface_ncurses.c ++++ b/src/interface_ncurses.c +@@ -188,7 +188,7 @@ void show_host_status(host_data * host, int colpair, int attr, char *statstr, + attroff(attr); + /* print time */ + get_currtime_str(NULL, time_str); +- mvprintw(0, COLS - 8, time_str); ++ mvprintw(0, COLS - 8, "%s", time_str); + refresh(); + } + } +@@ -319,11 +319,11 @@ void print_header(char *title) + printw("%s", line); + move(0, HDR_LINE_X_START); + sprintf(line, "Pinger v%s", VERSION); +- printw(line); ++ printw("%s", line); + title_start = strlen(line) + HDR_LINE_X_START + 1; + sprintf(line, _("'q' key to quit")); + move(0, COLS - strlen(line) - 9); /* 1 + clock width */ +- printw(line); ++ printw("%s", line); + title_maxlen = COLS - strlen(line) - 9 - title_start; + if ((title_maxlen > 4) && (title != NULL)) { + title_len = strlen(title); +@@ -342,7 +342,7 @@ void print_header(char *title) + for (idx = 0; idx < strlen(title_with_brackets); idx++) + if (title_with_brackets[idx] == '%') + title_with_brackets[idx] = ':'; +- printw(title_with_brackets); ++ printw("%s", title_with_brackets); + } + //if (title != NULL) free(title); + if (title_with_brackets != NULL) +@@ -351,7 +351,7 @@ void print_header(char *title) + attron(A_BOLD); + move(0, COLS - 8); + get_currtime_str(NULL, line); +- printw(line); ++ printw("%s", line); + free(line); + + move(1, 0); +-- +2.48.1 + diff --git a/net-analyzer/pinger/pinger-0.33-r1.ebuild b/net-analyzer/pinger/pinger-0.33-r2.ebuild similarity index 87% rename from net-analyzer/pinger/pinger-0.33-r1.ebuild rename to net-analyzer/pinger/pinger-0.33-r2.ebuild index 38ed420ff7df..ef60082f3865 100644 --- a/net-analyzer/pinger/pinger-0.33-r1.ebuild +++ b/net-analyzer/pinger/pinger-0.33-r2.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2022 Gentoo Authors +# Copyright 1999-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 @@ -36,6 +36,8 @@ PATCHES=( "${FILESDIR}"/${P}-gentoo.patch "${FILESDIR}"/${P}-musl-int-types.patch "${FILESDIR}"/${P}-clang16.patch + "${FILESDIR}"/${P}-interface_ncurses-fix-C23-compat.patch + "${FILESDIR}"/${P}-interface_ncurses-fix-Wformat-security.patch ) src_prepare() {
