summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-07-05 12:14:04 -0400
committerNick Mathewson <nickm@torproject.org>2016-07-05 12:14:04 -0400
commit87758dbebc7ab624ba7b8802478ae2dc980d90c0 (patch)
treef4e13772fa5c5ece2056827451d2a9d775acdc56 /src/or
parente889da1d7f34632dce24ab590b1df99d11b5c91c (diff)
parentcc34929abc3a5423372d1e12d47710ed366d43b4 (diff)
downloadtor-87758dbebc7ab624ba7b8802478ae2dc980d90c0.tar.gz
tor-87758dbebc7ab624ba7b8802478ae2dc980d90c0.zip
Merge remote-tracking branch 'dgoulet/bug19567_029_01'
Diffstat (limited to 'src/or')
-rw-r--r--src/or/shared_random.h6
-rw-r--r--src/or/shared_random_state.c6
2 files changed, 5 insertions, 7 deletions
diff --git a/src/or/shared_random.h b/src/or/shared_random.h
index d1ba99d1fe..9885934cc7 100644
--- a/src/or/shared_random.h
+++ b/src/or/shared_random.h
@@ -34,11 +34,11 @@
#define SR_SRV_MSG_LEN \
(SR_SRV_TOKEN_LEN + sizeof(uint64_t) + sizeof(uint32_t) + DIGEST256_LEN)
-/* Length of base64 encoded commit NOT including the NULL terminated byte.
- * Formula is taken from base64_encode_size. */
+/* Length of base64 encoded commit NOT including the NUL terminated byte.
+ * Formula is taken from base64_encode_size. This adds up to 56 bytes. */
#define SR_COMMIT_BASE64_LEN \
(((SR_COMMIT_LEN - 1) / 3) * 4 + 4)
-/* Length of base64 encoded reveal NOT including the NULL terminated byte.
+/* Length of base64 encoded reveal NOT including the NUL terminated byte.
* Formula is taken from base64_encode_size. This adds up to 56 bytes. */
#define SR_REVEAL_BASE64_LEN \
(((SR_REVEAL_LEN - 1) / 3) * 4 + 4)
diff --git a/src/or/shared_random_state.c b/src/or/shared_random_state.c
index 73df9c43fb..870b992837 100644
--- a/src/or/shared_random_state.c
+++ b/src/or/shared_random_state.c
@@ -617,26 +617,24 @@ disk_state_update(void)
/* Reset current disk state. */
disk_state_reset();
- /* First, update elements that we don't need to iterate over a list to
- * construct something. */
+ /* First, update elements that we don't need to do a construction. */
sr_disk_state->Version = sr_state->version;
sr_disk_state->ValidUntil = sr_state->valid_until;
sr_disk_state->ValidAfter = sr_state->valid_after;
/* Shared random values. */
next = &sr_disk_state->SharedRandValues;
- *next = NULL;
if (sr_state->previous_srv != NULL) {
*next = line = tor_malloc_zero(sizeof(config_line_t));
line->key = tor_strdup(dstate_prev_srv_key);
disk_state_put_srv_line(sr_state->previous_srv, line);
+ /* Go to the next shared random value. */
next = &(line->next);
}
if (sr_state->current_srv != NULL) {
*next = line = tor_malloc_zero(sizeof(*line));
line->key = tor_strdup(dstate_cur_srv_key);
disk_state_put_srv_line(sr_state->current_srv, line);
- next = &(line->next);
}
/* Parse the commits and construct config line(s). */