aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2020-01-06 13:24:01 -0500
committerNick Mathewson <nickm@torproject.org>2020-01-06 13:24:01 -0500
commit48f734178362d3a8b490a23ceff202a2027a27fc (patch)
tree47b85f54bd0a7f7f59d6bdb35c80e58c490c22e3
parent13216f848a120760fa372b9ae8f6d0840f4a83ba (diff)
parent6da989cfe8323418ee1f888287d0d65b21b60c1d (diff)
downloadtor-48f734178362d3a8b490a23ceff202a2027a27fc.tar.gz
tor-48f734178362d3a8b490a23ceff202a2027a27fc.zip
Merge branch 'maint-0.4.2'
-rw-r--r--changes/bug327714
-rw-r--r--changes/ticket327654
-rw-r--r--src/lib/confmgt/structvar.c4
-rw-r--r--src/lib/log/util_bug.h6
4 files changed, 14 insertions, 4 deletions
diff --git a/changes/bug32771 b/changes/bug32771
new file mode 100644
index 0000000000..606bcf4be4
--- /dev/null
+++ b/changes/bug32771
@@ -0,0 +1,4 @@
+ o Minor bugfixes (logging, crash):
+ - Avoid a possible crash when trying to log a (fatal) assertion failure
+ about mismatched magic numbers in configuration objects. Fixes bug 32771;
+ bugfix on 0.4.2.1-alpha.
diff --git a/changes/ticket32765 b/changes/ticket32765
new file mode 100644
index 0000000000..a9663a5df3
--- /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/confmgt/structvar.c b/src/lib/confmgt/structvar.c
index a2411477d6..ce8e426cda 100644
--- a/src/lib/confmgt/structvar.c
+++ b/src/lib/confmgt/structvar.c
@@ -71,8 +71,8 @@ struct_check_magic(const void *object, const struct_magic_decl_t *decl)
const uint32_t *ptr = STRUCT_VAR_P(object, decl->magic_offset);
tor_assertf(*ptr == decl->magic_val,
"Bad magic number on purported %s object. "
- "Expected %"PRIu32"x but got "PRIu32"x.",
- decl->magic_val, *ptr);
+ "Expected %"PRIu32"x but got %"PRIu32"x.",
+ decl->typename, decl->magic_val, *ptr);
}
/**
diff --git a/src/lib/log/util_bug.h b/src/lib/log/util_bug.h
index d0a311ac61..b7dcefcd96 100644
--- a/src/lib/log/util_bug.h
+++ b/src/lib/log/util_bug.h
@@ -247,10 +247,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;