summaryrefslogtreecommitdiff
blob: f1255d9e55f19e60380d4b92517df5f8f49dcff9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
From 801804d5b1beca5f32dd78cd23e9f9e012ae0420 Mon Sep 17 00:00:00 2001
From: Michael Orlitzky <michael@orlitzky.com>
Date: Tue, 2 Aug 2016 10:07:39 -0400
Subject: [PATCH 1/1] src/{input,output}.c: fix -Wformat-security errors.

Newer versions of GCC have the ability to warn about insecure uses of
format strings. These uses usually involve omitted "%s" format strings
to the printf() family of functions, and when compiling with
-Werror=format-security, they can cause the build to fail. This commit
fixes a few such uses in input.c and output.c

Gentoo-Bug: 521104
---
 src/input.c  | 4 ++--
 src/output.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/input.c b/src/input.c
index 79db485..92bad36 100644
--- a/src/input.c
+++ b/src/input.c
@@ -463,7 +463,7 @@ static gboolean get_file_to_load(gchar* file, gchar* pal_file, gboolean show_err
 	    return FALSE;
 	}
 	else
-	    sprintf(pal_file, file);
+	    sprintf(pal_file, "%s", file);
     }
 
     else
@@ -618,7 +618,7 @@ GHashTable* load_files()
 	FILE* pal_file_handle = NULL;
 
 	if(!get_file_to_load(settings->pal_file, pal_file, FALSE))
-	    sprintf(pal_file, settings->pal_file);
+	    sprintf(pal_file, "%s", settings->pal_file);
 
 	pal_file_handle = get_file_handle(pal_file, TRUE);
 	if(pal_file_handle != NULL)
diff --git a/src/output.c b/src/output.c
index 97aaa0f..9806089 100644
--- a/src/output.c
+++ b/src/output.c
@@ -249,7 +249,7 @@ static void pal_output_text_week(GDate* date, gboolean force_month_label,
 		pal_output_fg(BRIGHT, color, utf8_buf);
 	}
 	else
-	    g_print(utf8_buf);
+	    g_print("%s", utf8_buf);
 
 
 	if(g_date_compare(date,today) == 0)	/* make today bright */
@@ -270,7 +270,7 @@ static void pal_output_text_week(GDate* date, gboolean force_month_label,
 
 	}
 	else
-	    g_print(utf8_buf);
+	    g_print("%s", utf8_buf);
 
 
 	/* print extra space between days */
-- 
2.7.3