[tor-commits] [tor/master] Use CHECK_PRINTF() for printf-like functions in util_bug.h

nickm at torproject.org nickm at torproject.org
Mon Jan 6 18:26:39 UTC 2020


commit 1b619a627ca1ee11d1680dc56e90e9fc1af2ddb5
Author: Nick Mathewson <nickm at torproject.org>
Date:   Mon Dec 16 15:14:13 2019 -0500

    Use CHECK_PRINTF() for printf-like functions in util_bug.h
---
 changes/ticket32765    | 4 ++++
 src/lib/log/util_bug.h | 6 ++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/changes/ticket32765 b/changes/ticket32765
new file mode 100644
index 000000000..a9663a5df
--- /dev/null
+++ b/changes/ticket32765
@@ -0,0 +1,4 @@
+  o Minor bugfixes (correctness checks):
+    - Use GCC/Clang's printf-checking feature to make sure that
+      tor_assertf() arguments are correctly typed. Fixes bug 32765;
+      bugfix on 0.4.1.1-alpha.
diff --git a/src/lib/log/util_bug.h b/src/lib/log/util_bug.h
index 546ae1e3e..993a4e3ab 100644
--- a/src/lib/log/util_bug.h
+++ b/src/lib/log/util_bug.h
@@ -242,10 +242,12 @@
 
 void tor_assertion_failed_(const char *fname, unsigned int line,
                            const char *func, const char *expr,
-                           const char *fmt, ...);
+                           const char *fmt, ...)
+    CHECK_PRINTF(5,6);
 void tor_bug_occurred_(const char *fname, unsigned int line,
                        const char *func, const char *expr,
-                       int once, const char *fmt, ...);
+                       int once, const char *fmt, ...)
+  CHECK_PRINTF(6,7);
 
 void tor_abort_(void) ATTR_NORETURN;
 





More information about the tor-commits mailing list