Control: tags -1 + patch
Am 27.09.2021 um 22:25 schrieb Helmut Grohne:
> Source: horst
> Version: 5.1-2
> Severity: serious
> Tags: ftbfs
>
> horst fails to build from source in unstable on amd64 due to ncurses
> having become stricter about format strings. A build now ends as
> follows:
>
> | cc -g -O2
> | -ffile-prefix-map=/<>=. -fstack-protector-strong
> | -Wformat -Werror=format-security -std=gnu99 -Wall -Wextra -g
> | -I. -DVERSION=\"5.1\" -DDO_DEBUG -I/usr/include/libnl3 -Wdate-time
> | -D_FORTIFY_SOURCE=2 -c -o display-main.o display-main.c
> | display-main.c: In function ‘print_dump_win’:
> | display-main.c:56:2: error: format not a string literal and no format
> arguments [-Werror=format-security]
> |56 | wprintw(dump_win, str);
> | | ^~~
> | display-main.c: In function ‘print_node_list_line’:
> | display-main.c:255:40: warning: format ‘%d’ expects argument of type
> | ‘int’, but argument 5 has type ‘long unsigned int’ [-Wformat=]
> | 255 | mvwprintw(list_win, line, COL_SIG, "%3d",
> -ewma_read(&n->phy_sig_avg));
> | | ~~^
> ~~~
> | || |
> | |int long unsigned int
> | | %3ld
> | display-main.c: In function ‘update_dump_win’:
> | display-main.c:455:21: warning: too many arguments for format
> [-Wformat-extra-args]
> | 455 | wprintw(dump_win, "%-7s", "ARP", ip_sprintf(p->ip_src));
> | | ^~
> | display-main.c:481:31: warning: format ‘%llx’ expects argument of
> | type ‘long long unsigned int’, but argument 4 has type ‘uint64_t’
> | {aka ‘long unsigned int’} [-Wformat=]
> | 481 |wprintw(dump_win, "'%s' %llx", p->wlan_essid,
> | |~~~^
> | | |
> | | long long unsigned int
> | |%lx
> | 482 | p->wlan_tsf);
> | | ~~~
> | | |
> | | uint64_t {aka long unsigned int}
> | display-main.c: In function ‘sort_input’:
> | display-main.c:129:11: warning: this statement may fall through
> [-Wimplicit-fallthrough=]
> | 129 | do_sort = c;
> | | ^~~
> | display-main.c:131:2: note: here
> | 131 | case '\r': case KEY_ENTER:
> | | ^~~~
> | cc1: some warnings being treated as errors
> | make[1]: *** [: display-main.o] Error 1
> | make[1]: Leaving directory '/<>'
> | dh_auto_build: error: make -j1 returned exit code 2
> | make: *** [debian/rules:19: build] Error 25
> | dpkg-buildpackage: error: debian/rules build subprocess returned exit
> status 2
I have attached a patch for the two errors, adding "%s" as penultimate
argument to the *printw calls. Did not really look at the warnings.
From 8110d832bd6502b7caed75b6504bd6d24d30d36b Mon Sep 17 00:00:00 2001
From: Sven Joachim
Date: Thu, 14 Oct 2021 20:06:26 +0200
Subject: [PATCH] Fix string format errors with recent ncurses
---
display-main.c | 2 +-
display.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/display-main.c b/display-main.c
index b613291..6519895 100644
--- a/display-main.c
+++ b/display-main.c
@@ -53,7 +53,7 @@ static struct ewma bpsn_avg;
void print_dump_win(const char *str, int refresh)
{
wattron(dump_win, RED);
- wprintw(dump_win, str);
+ wprintw(dump_win, "%s", str);
wattroff(dump_win, RED);
if (refresh)
wrefresh(dump_win);
diff --git a/display.c b/display.c
index 777c7a2..e0755f4 100644
--- a/display.c
+++ b/display.c
@@ -86,7 +86,7 @@ print_centered(WINDOW* win, int line, int cols, const char *fmt, ...)
vsnprintf(buf, cols, fmt, ap);
va_end(ap);
- mvwprintw(win, line, cols / 2 - strlen(buf) / 2, buf);
+ mvwprintw(win, line, cols / 2 - strlen(buf) / 2, "%s", buf);
free(buf);
}
--
2.33.0