Skip to content
Permalink
Browse files
Correct the warning when a rendezvous descriptor exceeds REND_DESC_MA…
…X_SIZE

The warning incorrectly referred to the limit as being kilobytes.
Also moved this test to before the descriptor's hash is calculated.
Fixes bug 2750, bugfix on 0.2.1.5-alpha.
  • Loading branch information
special committed Mar 14, 2011
1 parent 151ab61 commit 491658dd3949e7ceeca3279b5e759559c02c8ff2
Showing with 11 additions and 7 deletions.
  1. +4 −0 changes/bug2750
  2. +7 −7 src/or/routerparse.c
@@ -0,0 +1,4 @@
o Minor bugfixes
- Correct the warning displayed when a rendezvous descriptor exceeds
the maximum size, and test this slightly earlier during parsing.
Fixes bug 2750; bugfix on 0.2.1.5-alpha. Patch by John Brooks.
@@ -3613,6 +3613,13 @@ rend_parse_v2_service_descriptor(rend_service_descriptor_t **parsed_out,
log_info(LD_REND, "Descriptor does not start correctly.");
goto err;
}
/* Check length. */
if (strlen(desc) > REND_DESC_MAX_SIZE) {
log_warn(LD_REND, "Descriptor length is %i which exceeds "
"maximum rendezvous descriptor size of %i bytes.",
(int)strlen(desc), REND_DESC_MAX_SIZE);
goto err;
}
/* Compute descriptor hash for later validation. */
if (router_get_hash_impl(desc, strlen(desc), desc_hash,
"rendezvous-service-descriptor ",
@@ -3626,13 +3633,6 @@ rend_parse_v2_service_descriptor(rend_service_descriptor_t **parsed_out,
eos = desc + strlen(desc);
else
eos = eos + 1;
/* Check length. */
if (strlen(desc) > REND_DESC_MAX_SIZE) {
log_warn(LD_REND, "Descriptor length is %i which exceeds "
"maximum rendezvous descriptor size of %i kilobytes.",
(int)strlen(desc), REND_DESC_MAX_SIZE);
goto err;
}
/* Tokenize descriptor. */
area = memarea_new();
if (tokenize_string(area, desc, eos, tokens, desc_token_table, 0)) {

0 comments on commit 491658d

Please sign in to comment.