From de169b3ad09b9d5acb78158afd87b87158ed5a7c Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: May 03 2022 18:35:31 +0000 Subject: Fix build with ncurses-6.3 (BZ#2080201) --- diff --git a/liboping-1.10.0-ncurses-6.3.patch b/liboping-1.10.0-ncurses-6.3.patch new file mode 100644 index 0000000..d29afab --- /dev/null +++ b/liboping-1.10.0-ncurses-6.3.patch @@ -0,0 +1,51 @@ +From 609559aa3b257a5eb627717d870dfce336f941ec Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich +Date: Mon, 15 Nov 2021 08:05:43 +0000 +Subject: [PATCH] src/oping.c: always use "%s"-style format for printf()-style + functions + +`ncuses-6.3` added printf-style function attributes and now makes +it easier to catch cases when user input is used in palce of format +string when built with CFLAGS=-Werror=format-security: + + oping.c:1265:41: error: format not a string literal and no format arguments [-Werror=format-security] + 1265 | hist_symbols_utf8[index]); + | ^~~~~~~~~~~~~~~~~ + +Let's wrap all the missing places with "%s" format. +--- + src/oping.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/src/oping.c b/src/oping.c +index c087c80..af4a0cb 100644 +--- a/src/oping.c ++++ b/src/oping.c +@@ -1156,7 +1156,7 @@ static int update_graph_prettyping (ping_context_t *ctx, /* {{{ */ + wattron (ctx->window, COLOR_PAIR(color)); + + if (has_utf8()) +- mvwprintw (ctx->window, /* y = */ 3, /* x = */ x + 2, symbol); ++ mvwprintw (ctx->window, /* y = */ 3, /* x = */ x + 2, "%s", symbol); + else + mvwaddch (ctx->window, /* y = */ 3, /* x = */ x + 2, symbolc); + +@@ -1262,7 +1262,7 @@ static int update_graph_histogram (ping_context_t *ctx) /* {{{ */ + mvwaddch (ctx->window, /* y = */ 3, /* x = */ x + 2, ' '); + else if (has_utf8 ()) + mvwprintw (ctx->window, /* y = */ 3, /* x = */ x + 2, +- hist_symbols_utf8[index]); ++ "%s", hist_symbols_utf8[index]); + else + mvwaddch (ctx->window, /* y = */ 3, /* x = */ x + 2, + hist_symbols_acs[index] | A_ALTCHARSET); +@@ -1639,8 +1639,7 @@ static void update_host_hook (pingobj_iter_t *iter, /* {{{ */ + + HOST_PRINTF ("%zu bytes from %s (%s): icmp_seq=%u ttl=%i ", + data_len, context->host, context->addr, +- sequence, recv_ttl, +- format_qos (recv_qos, recv_qos_str, sizeof (recv_qos_str))); ++ sequence, recv_ttl); + if ((recv_qos != 0) || (opt_send_qos != 0)) + { + HOST_PRINTF ("qos=%s ", diff --git a/liboping.spec b/liboping.spec index f4412a4..893fdd3 100644 --- a/liboping.spec +++ b/liboping.spec @@ -1,6 +1,6 @@ Name: liboping Version: 1.10.0 -Release: 20%{?dist} +Release: 21%{?dist} Summary: A C library to generate ICMP echo requests License: GPLv2 @@ -8,6 +8,10 @@ URL: https://noping.cc/ Source0: https://noping.cc/files/%{name}-%{version}.tar.bz2 # Disable -Werror to avoid https://github.com/octo/liboping/issues/38 Patch0: liboping-1.10.0-no-werror.patch +# Fix build with ncurses-6.3 https://github.com/octo/liboping/pull/61 +# Note: slightly tweaked, since we don't have +# https://github.com/octo/liboping/commit/47130cb9c2cdc900acf1daca1d028c87eccd2004 +Patch1: liboping-1.10.0-ncurses-6.3.patch BuildRequires: gcc BuildRequires: perl-devel @@ -88,6 +92,9 @@ LD_LIBRARY_PATH=../../src/.libs make -C bindings/perl test %{_mandir}/man3/ping_setopt.3* %changelog +* Tue May 03 2022 Frantisek Sumsal - 1.10.0-21 +- Fix build with ncurses-6.3 (BZ#2080201) + * Thu Jan 20 2022 Fedora Release Engineering - 1.10.0-20 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild