From: Michael Tremer Date: Sat, 4 Mar 2023 14:33:09 +0000 (+0000) Subject: liboping: Fix some string formatting errors X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0d758e19f54be96d21ed68fa8a57b80708f536c;p=ipfire-3.x.git liboping: Fix some string formatting errors Signed-off-by: Michael Tremer --- diff --git a/liboping/liboping.nm b/liboping/liboping.nm index e775143a7..8f2296e7f 100644 --- a/liboping/liboping.nm +++ b/liboping/liboping.nm @@ -5,7 +5,7 @@ name = liboping version = 1.10.0 -release = 3 +release = 4 groups = Development/Tools url = https://noping.cc/ diff --git a/liboping/patches/liboping-1.10.0-ncurses-6.3.patch b/liboping/patches/liboping-1.10.0-ncurses-6.3.patch new file mode 100644 index 000000000..d29afab6a --- /dev/null +++ b/liboping/patches/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/patches/liboping-1.10.0-no-werror.patch b/liboping/patches/liboping-1.10.0-no-werror.patch new file mode 100644 index 000000000..56a70a533 --- /dev/null +++ b/liboping/patches/liboping-1.10.0-no-werror.patch @@ -0,0 +1,22 @@ +--- liboping-1.10.0/src/Makefile.am 2017-05-11 00:32:27.000000000 -0700 ++++ liboping-1.10.0/src/Makefile.am.new 2018-07-24 14:29:43.400661398 -0700 +@@ -3,7 +3,7 @@ + SUBDIRS = mans + + if COMPILER_IS_GCC +-AM_CFLAGS = -Wall -Werror ++AM_CFLAGS = -Wall + endif + + include_HEADERS = oping.h +--- liboping-1.10.0/src/Makefile.in 2018-07-24 14:30:52.192553951 -0700 ++++ liboping-1.10.0/src/Makefile.in.new 2018-07-24 14:30:57.281546003 -0700 +@@ -388,7 +388,7 @@ + top_srcdir = @top_srcdir@ + AUTOMAKE_OPTIONS = foreign no-dependencies + SUBDIRS = mans +-@COMPILER_IS_GCC_TRUE@AM_CFLAGS = -Wall -Werror ++@COMPILER_IS_GCC_TRUE@AM_CFLAGS = -Wall + include_HEADERS = oping.h + lib_LTLIBRARIES = liboping.la +