summaryrefslogtreecommitdiff
path: root/src/feature/relay/router.c
diff options
context:
space:
mode:
authorteor <teor@torproject.org>2019-06-24 21:30:47 +1000
committerteor <teor@torproject.org>2019-06-24 21:30:47 +1000
commitb7dda83cfa40bb23c53f08f9ca332a17eacc319b (patch)
tree8d0d14d421d4e24bd4db17a68c8db73a364a7555 /src/feature/relay/router.c
parentb0fa1f4fb0b4f6a474b20e40e2810936c0577cc2 (diff)
parent5beb32d3d9a9640e515e6369d3a908e93b8895ef (diff)
downloadtor-b7dda83cfa40bb23c53f08f9ca332a17eacc319b.tar.gz
tor-b7dda83cfa40bb23c53f08f9ca332a17eacc319b.zip
Merge branch 'bug30958_029' into bug30958_035
Diffstat (limited to 'src/feature/relay/router.c')
-rw-r--r--src/feature/relay/router.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c
index dad2c6a50f..e796b366d8 100644
--- a/src/feature/relay/router.c
+++ b/src/feature/relay/router.c
@@ -2980,11 +2980,13 @@ extrainfo_dump_to_string(char **s_out, extrainfo_t *extrainfo,
while (strlen(s) > MAX_EXTRAINFO_UPLOAD_SIZE - DIROBJ_MAX_SIG_LEN) {
/* So long as there are at least two chunks (one for the initial
* extra-info line and one for the router-signature), we can keep removing
- * things. */
- if (smartlist_len(chunks) > 2) {
- /* We remove the next-to-last element (remember, len-1 is the last
- element), since we need to keep the router-signature element. */
- int idx = smartlist_len(chunks) - 2;
+ * things. If emit_ed_sigs is true, we also keep 2 additional chunks at the
+ * end for the ed25519 signature. */
+ const int required_chunks = emit_ed_sigs ? 4 : 2;
+ if (smartlist_len(chunks) > required_chunks) {
+ /* We remove the next-to-last or 4th-last element (remember, len-1 is the
+ * last element), since we need to keep the router-signature elements. */
+ int idx = smartlist_len(chunks) - required_chunks;
char *e = smartlist_get(chunks, idx);
smartlist_del_keeporder(chunks, idx);
log_warn(LD_GENERAL, "We just generated an extra-info descriptor "