summarylogtreecommitdiffstats
path: root/0001-Fix-compile-with-Werror-format-security.patch
blob: 34bac8f2fa024ae9f58da509c66fc9fb62594181 (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
From 7fb2aed4607ff31a89841ac1dded72f9817b0bcc Mon Sep 17 00:00:00 2001
From: Xiretza <xiretza@xiretza.xyz>
Date: Fri, 24 Sep 2021 14:17:39 +0200
Subject: [PATCH] Fix compile with -Werror=format-security
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

In file included from helloworld1.c:8:
mylog.h: In function ‘mylog_msg’:
mylog.h:42:9: error: format not a string literal and no format arguments [-Werror=format-security]
   42 |         log4c_category_log(log4c_category_get(catName), a_priority, msg);
      |         ^~~~~~~~~~~~~~~~~~
---
 examples/helloworld1/mylog.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/examples/helloworld1/mylog.h b/examples/helloworld1/mylog.h
index 280f3dc..f8e0c81 100644
--- a/examples/helloworld1/mylog.h
+++ b/examples/helloworld1/mylog.h
@@ -39,9 +39,9 @@ static LOG4C_INLINE int mylog_fini(){
 
 static LOG4C_INLINE void mylog_msg(char *catName,int a_priority, char *msg){
 #ifndef WITHOUT_LOG4C
-	log4c_category_log(log4c_category_get(catName), a_priority, msg);
+	log4c_category_log(log4c_category_get(catName), a_priority, "%s", msg);
 #else
-	printf(msg);
+	printf("%s", msg);
 #endif
 }
 
-- 
2.33.0