Package: mupen64plus-core / 2.5-4

Add-printf-format-attribute.patch Patch series | download
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
65
66
67
68
69
70
71
72
From: Sven Eckelmann <sven@narfation.org>
Date: Thu, 9 Sep 2010 13:11:05 +0200
Subject: Add printf-format attribute

The compiler needs to get more information for function declaration to
help to find printf specific format attacks.

Forwarded: not-needed
---
 src/api/callbacks.h        | 2 +-
 src/debugger/dbg_decoder.c | 5 +++++
 src/main/main.h            | 2 +-
 src/osd/osd.h              | 4 ++--
 4 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/api/callbacks.h b/src/api/callbacks.h
index de260c7..697ef5c 100644
--- a/src/api/callbacks.h
+++ b/src/api/callbacks.h
@@ -32,7 +32,7 @@
 /* Functions for use by the Core, to send information back to the front-end app */
 extern m64p_error SetDebugCallback(ptr_DebugCallback pFunc, void *Context);
 extern m64p_error SetStateCallback(ptr_StateCallback pFunc, void *Context);
-extern void       DebugMessage(int level, const char *message, ...);
+extern void       DebugMessage(int level, const char *message, ...) __attribute__ ((format (printf, 2, 3)));
 extern void       StateChanged(m64p_core_param param_type, int new_value);
 
 #endif /* API_CALLBACKS_H */
diff --git a/src/debugger/dbg_decoder.c b/src/debugger/dbg_decoder.c
index 94cbdc8..1a03674 100644
--- a/src/debugger/dbg_decoder.c
+++ b/src/debugger/dbg_decoder.c
@@ -229,6 +229,11 @@ lookup_rel_lo16 ( struct r4k_dis_t * state,
 static int
 db_printf ( struct r4k_dis_t * state,
             char * fmt, 
+            ...                       ) __attribute__ ((format (printf, 2, 3)));
+
+static int
+db_printf ( struct r4k_dis_t * state,
+            char * fmt, 
             ...                       )
 {
     int l;
diff --git a/src/main/main.h b/src/main/main.h
index 3b4f72c..e556170 100644
--- a/src/main/main.h
+++ b/src/main/main.h
@@ -72,7 +72,7 @@ void new_frame(void);
 void new_vi(void);
 
 int  main_set_core_defaults(void);
-void main_message(m64p_msg_level level, unsigned int osd_corner, const char *format, ...);
+void main_message(m64p_msg_level level, unsigned int osd_corner, const char *format, ...) __attribute__ ((format (printf, 3, 4)));
 
 m64p_error main_run(void);
 void main_stop(void);
diff --git a/src/osd/osd.h b/src/osd/osd.h
index bbdd699..8779ffb 100644
--- a/src/osd/osd.h
+++ b/src/osd/osd.h
@@ -93,8 +93,8 @@ extern "C" {
 void osd_init(int width, int height);
 void osd_exit(void);
 void osd_render(void);
-osd_message_t * osd_new_message(enum osd_corner, const char *, ...);
-void osd_update_message(osd_message_t *, const char *, ...);
+osd_message_t * osd_new_message(enum osd_corner, const char *, ...) __attribute__ ((format (printf, 2, 3)));
+void osd_update_message(osd_message_t *, const char *, ...) __attribute__ ((format (printf, 2, 3)));
 void osd_delete_message(osd_message_t *);
 void osd_message_set_static(osd_message_t *);
 void osd_message_set_user_managed(osd_message_t *);