]> git.pld-linux.org Git - packages/irqbalance.git/blame - build.patch
Up to 1.8.0.
[packages/irqbalance.git] / build.patch
CommitLineData
a73bb7fb
AM
1From f8bdd0e64284d841544fd3ebe22f4652902ba8d2 Mon Sep 17 00:00:00 2001
2From: Sergei Trofimovich <slyich@gmail.com>
3Date: Tue, 9 Nov 2021 22:24:17 +0000
4Subject: [PATCH] ui/ui.c: always use "%s"-style format for printf()-style
5 functions
6
7`ncuses-6.3` added printf-style function attributes and now makes
8it easier to catch cases when user input is used in palce of format
9string when built with CFLAGS=-Werror=format-security:
10
11 ui/ui.c:714:16: error: format not a string literal and no format arguments [-Werror=format-security]
12 714 | printw(copy_to);
13 | ^~~~~~~
14
15Let's wrap all the missing places with "%s" format.
16---
17 ui/ui.c | 12 ++++++------
18 1 file changed, 6 insertions(+), 6 deletions(-)
19
20diff --git a/ui/ui.c b/ui/ui.c
21index 1be8f95..6ff3305 100644
22--- a/ui/ui.c
23+++ b/ui/ui.c
24@@ -26,7 +26,7 @@ void show_frame()
25 while(strlen(top) != (size_t)COLS - 1) {
26 snprintf(top + strlen(top), COLS - strlen(top), " ");
27 }
28- mvprintw(0, 0, top);
29+ mvprintw(0, 0, "%s", top);
30 for(i = 0; i < LINES; i++) {
31 mvprintw(i, 0, " ");
32 mvprintw(i, COLS - 1, " ");
33@@ -42,7 +42,7 @@ void show_footer()
34 snprintf(footer + strlen(footer), COLS - strlen(footer), " ");
35 }
36 attrset(COLOR_PAIR(4));
37- mvprintw(LINES - 1, 0, footer);
38+ mvprintw(LINES - 1, 0, "%s", footer);
39 }
40
41 char * check_control_in_sleep_input(int max_len, int column_offest, int line_offset)
42@@ -331,7 +331,7 @@ void print_assigned_objects_string(irq_t *irq, int *line_offset)
43 char assigned_to[128] = "\0";
44 for_each_int(irq->assigned_to, copy_assigned_obj, assigned_to);
45 assigned_to[strlen(assigned_to) - 2] = '\0';
46- mvprintw(*line_offset, 36, assigned_to);
47+ mvprintw(*line_offset, 36, "%s", assigned_to);
48 }
49
50 void print_irq_line(irq_t *irq, void *data)
51@@ -566,7 +566,7 @@ void settings()
52 uint8_t sleep_input_offset = strlen(info) + 3;
53 snprintf(info + strlen(info), 128 - strlen(info), "%" PRIu64 "\n", setup.sleep);
54 attrset(COLOR_PAIR(1));
55- mvprintw(2, 3, info);
56+ mvprintw(2, 3, "%s", info);
57 print_all_cpus();
58
59 int user_input = 1;
60@@ -664,7 +664,7 @@ void display_tree_node_irqs(irq_t *irq, void *data)
61 char indent[32] = " \0";
62 snprintf(indent + strlen(indent), 32 - strlen(indent), "%s", (char *)data);
63 attrset(COLOR_PAIR(3));
64- printw("%sIRQ %lu, IRQs since last rebalance %lu\n",
65+ printw("%sIRQ %u, IRQs since last rebalance %lu\n",
66 indent, irq->vector, irq->diff);
67 }
68
69@@ -711,7 +711,7 @@ void display_tree_node(cpu_node_t *node, void *data)
70 default:
71 break;
72 }
73- printw(copy_to);
74+ printw("%s", copy_to);
75 if(g_list_length(node->irqs) > 0) {
76 for_each_irq(node->irqs, display_tree_node_irqs, indent);
77 }
This page took 0.16265 seconds and 4 git commands to generate.