summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-02-19 10:24:03 -0500
committerNick Mathewson <nickm@torproject.org>2015-02-19 11:35:27 -0500
commit76d8c23ab40b49c3c43570231db47eecc43bf635 (patch)
treef024c48ec03e1f3fc0ca490de8ced7b8746887fe
parentcef802a041e0f979295a890efe20a5ff924a1719 (diff)
downloadtor-76d8c23ab40b49c3c43570231db47eecc43bf635.tar.gz
tor-76d8c23ab40b49c3c43570231db47eecc43bf635.zip
Try to fix authdir_newdesc events
We were sending values that were truncated by the length of the annotations.
-rw-r--r--changes/bug149533
-rw-r--r--src/or/dirserv.c8
2 files changed, 7 insertions, 4 deletions
diff --git a/changes/bug14953 b/changes/bug14953
new file mode 100644
index 0000000000..0fb0a64e29
--- /dev/null
+++ b/changes/bug14953
@@ -0,0 +1,3 @@
+ o Minor bugfixes (directory authority):
+ - Fix a bug that was truncating AUTHDIR_NEWDESC events sent to the
+ control port. Fixes bug 14953; bugfix on 0.2.0.1-alpha.
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 114b26163d..e5a5b54303 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -537,7 +537,8 @@ dirserv_add_descriptor(routerinfo_t *ri, const char **msg, const char *source)
was_router_added_t r;
routerinfo_t *ri_old;
char *desc, *nickname;
- size_t desclen = 0;
+ const size_t desclen = ri->cache_info.signed_descriptor_len +
+ ri->cache_info.annotations_len;
*msg = NULL;
/* If it's too big, refuse it now. Otherwise we'll cache it all over the
@@ -551,7 +552,7 @@ dirserv_add_descriptor(routerinfo_t *ri, const char **msg, const char *source)
*msg = "Router descriptor was too large.";
control_event_or_authdir_new_descriptor("REJECTED",
ri->cache_info.signed_descriptor_body,
- ri->cache_info.signed_descriptor_len, *msg);
+ desclen, *msg);
routerinfo_free(ri);
return ROUTER_AUTHDIR_REJECTS;
}
@@ -572,14 +573,13 @@ dirserv_add_descriptor(routerinfo_t *ri, const char **msg, const char *source)
"the last one with this identity.";
control_event_or_authdir_new_descriptor("DROPPED",
ri->cache_info.signed_descriptor_body,
- ri->cache_info.signed_descriptor_len, *msg);
+ desclen, *msg);
routerinfo_free(ri);
return ROUTER_IS_ALREADY_KNOWN;
}
/* Make a copy of desc, since router_add_to_routerlist might free
* ri and its associated signed_descriptor_t. */
- desclen = ri->cache_info.signed_descriptor_len;
desc = tor_strndup(ri->cache_info.signed_descriptor_body, desclen);
nickname = tor_strdup(ri->nickname);