commit: 091ffea0fba395a2e090098ac142e29c0f1fbd9e Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Wed Feb 12 15:37:43 2025 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Wed Feb 12 15:45:00 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=091ffea0
net-analyzer/nast: fix modern C issue, -Wformat-security Closes: https://bugs.gentoo.org/944402 Signed-off-by: Sam James <sam <AT> gentoo.org> .../nast/files/0001-Fix-signal-handler.patch | 43 ++++++++++++++++ .../nast/files/0002-Fix-Wformat-security.patch | 58 ++++++++++++++++++++++ .../{nast-0.2.0-r3.ebuild => nast-0.2.0-r4.ebuild} | 4 +- 3 files changed, 104 insertions(+), 1 deletion(-) diff --git a/net-analyzer/nast/files/0001-Fix-signal-handler.patch b/net-analyzer/nast/files/0001-Fix-signal-handler.patch new file mode 100644 index 000000000000..7961649e7db6 --- /dev/null +++ b/net-analyzer/nast/files/0001-Fix-signal-handler.patch @@ -0,0 +1,43 @@ +From eff649cd681e52b953dcf37065a7035246930858 Mon Sep 17 00:00:00 2001 +From: Sam James <[email protected]> +Date: Wed, 12 Feb 2025 15:32:37 +0000 +Subject: [PATCH 1/2] Fix signal handler + +Signal handlers need to take an argument. + +Bug: https://bugs.gentoo.org/944402 +Signed-off-by: Sam James <[email protected]> +--- + common.c | 2 +- + include/nast.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/common.c b/common.c +index 5649295..f2b60f4 100644 +--- a/common.c ++++ b/common.c +@@ -226,7 +226,7 @@ void openfile(void) + } + + /* signal handler */ +-void sigexit() ++void sigexit(int unused) + { + #ifdef HAVE_LIBNCURSES + # include <ncurses.h> +diff --git a/include/nast.h b/include/nast.h +index f5cd047..a65a404 100644 +--- a/include/nast.h ++++ b/include/nast.h +@@ -73,7 +73,7 @@ int car (char *dev, int lg); + int run_bc (char *dev, char *filter); + + /* other functions*/ +-void sigexit(); ++void sigexit(int unused); + void openfile(void); + void bkg(void); + +-- +2.48.1 + diff --git a/net-analyzer/nast/files/0002-Fix-Wformat-security.patch b/net-analyzer/nast/files/0002-Fix-Wformat-security.patch new file mode 100644 index 000000000000..039950a6344e --- /dev/null +++ b/net-analyzer/nast/files/0002-Fix-Wformat-security.patch @@ -0,0 +1,58 @@ +From 63598f0194ec0b291af30d8d7b3ee7bab1cd0928 Mon Sep 17 00:00:00 2001 +From: Sam James <[email protected]> +Date: Wed, 12 Feb 2025 15:35:13 +0000 +Subject: [PATCH 2/2] Fix -Wformat-security + +Signed-off-by: Sam James <[email protected]> +--- + bcount.c | 2 +- + ncurses/n_nast.c | 6 +++--- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/bcount.c b/bcount.c +index 3130188..7987ac6 100644 +--- a/bcount.c ++++ b/bcount.c +@@ -153,7 +153,7 @@ void bytecounting () + else icons++; + + sprintf (value, "%Ld", number); +- printf (value); ++ printf ("%s", value); + + /* calculate space */ + if (strlen(value) < 6) printf ("\t\t"); +diff --git a/ncurses/n_nast.c b/ncurses/n_nast.c +index 3e02859..ba50f2f 100644 +--- a/ncurses/n_nast.c ++++ b/ncurses/n_nast.c +@@ -641,7 +641,7 @@ void title(void) + title = subwin(stdscr,3,COLS,0,0); + wbkgd(title,COLOR_PAIR(1)); + box(title,0,0); +- mvwprintw(title,1,(COLS-sizeof(TITLE))/2, TITLE); ++ mvwprintw(title,1,(COLS-sizeof(TITLE))/2, "%s", TITLE); + wrefresh(title); + } + +@@ -748,7 +748,7 @@ void pop_up_win(void) + pop_up = newwin(17,55,(LINES-17)/2,(COLS-55)/2); + wbkgd(pop_up,COLOR_PAIR(4)); + box(pop_up,0,0); +- mvwprintw(pop_up,0,(55 -strlen(message))/2, message); ++ mvwprintw(pop_up,0,(55 -strlen(message))/2, "%s", message); + wrefresh(pop_up); + } + +@@ -759,7 +759,7 @@ void help_win(void) + help = newwin(23,67,(LINES-23)/2,(COLS-67)/2); + wbkgd(help,COLOR_PAIR(4)); + box(help,0,0); +- mvwprintw(help,0,(67 -strlen(message))/2, message); ++ mvwprintw(help,0,(67 -strlen(message))/2, "%s", message); + wrefresh(help); + } + +-- +2.48.1 + diff --git a/net-analyzer/nast/nast-0.2.0-r3.ebuild b/net-analyzer/nast/nast-0.2.0-r4.ebuild similarity index 86% rename from net-analyzer/nast/nast-0.2.0-r3.ebuild rename to net-analyzer/nast/nast-0.2.0-r4.ebuild index fa2602d1b025..7417306e5b69 100644 --- a/net-analyzer/nast/nast-0.2.0-r3.ebuild +++ b/net-analyzer/nast/nast-0.2.0-r4.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2024 Gentoo Authors +# Copyright 1999-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 @@ -24,6 +24,8 @@ BDEPEND="virtual/pkgconfig" PATCHES=( "${FILESDIR}"/${P}-gentoo.patch + "${FILESDIR}"/0001-Fix-signal-handler.patch + "${FILESDIR}"/0002-Fix-Wformat-security.patch ) src_prepare() {
