aboutsummaryrefslogtreecommitdiff
path: root/src/app/config/statefile.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-10-25 08:09:05 -0400
committerNick Mathewson <nickm@torproject.org>2019-10-25 08:09:05 -0400
commit63f2a310cbeb5908a202ba17da7e66535c77c894 (patch)
treed91dcad494b9d3e0333d6417a776a5f4c2eb7675 /src/app/config/statefile.c
parentaa6b4b62db0ef9e0e9e4c9d716d7b860f8f4a238 (diff)
downloadtor-63f2a310cbeb5908a202ba17da7e66535c77c894.tar.gz
tor-63f2a310cbeb5908a202ba17da7e66535c77c894.zip
config,state: check magic in all callbacks.
Diffstat (limited to 'src/app/config/statefile.c')
-rw-r--r--src/app/config/statefile.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/app/config/statefile.c b/src/app/config/statefile.c
index d3a0ec1790..834ad93ed7 100644
--- a/src/app/config/statefile.c
+++ b/src/app/config/statefile.c
@@ -184,6 +184,10 @@ get_state_mgr(void)
return state_mgr;
}
+#define CHECK_STATE_MAGIC(s) STMT_BEGIN \
+ config_check_toplevel_magic(get_state_mgr(), (s)); \
+ STMT_END
+
/** Persistent serialized state. */
static or_state_t *global_state = NULL;
@@ -286,6 +290,7 @@ or_state_validate_cb(const void *old_state, void *state_, char **msg)
/* There is not a meaningful concept of a state-to-state transition,
* since we do not reload the state after we start. */
(void) old_state;
+ CHECK_STATE_MAGIC(state_);
or_state_t *state = state_;