summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2005-07-22 00:14:58 +0000
committerRoger Dingledine <arma@torproject.org>2005-07-22 00:14:58 +0000
commit1efeb3908a6e501b950d52ed5e410d2cc933e700 (patch)
tree0c4711e6a2e57fcc2ebee1567fd4bbc2d352435e
parent550ec09ffa46ce5462f9a05a0e37ced427bbe5d9 (diff)
downloadtor-1efeb3908a6e501b950d52ed5e410d2cc933e700.tar.gz
tor-1efeb3908a6e501b950d52ed5e410d2cc933e700.zip
let hidden service descriptors publish 0 intro points
nick, please check the logic here svn:r4627
-rw-r--r--src/or/rendcommon.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c
index 2e3564de55..40f416fff1 100644
--- a/src/or/rendcommon.c
+++ b/src/or/rendcommon.c
@@ -72,14 +72,14 @@ rend_encode_service_descriptor(rend_service_descriptor_t *desc,
set_uint16(cp, htons((uint16_t)desc->n_intro_points));
cp += 2;
if (version == 0) {
- tor_assert(desc->intro_points);
for (i=0; i < desc->n_intro_points; ++i) {
char *ipoint = (char*)desc->intro_points[i];
strlcpy(cp, ipoint, *len_out-(cp-*str_out));
cp += strlen(ipoint)+1;
}
} else {
- tor_assert(desc->intro_point_extend_info);
+ if (desc->n_intro_points)
+ tor_assert(desc->intro_point_extend_info);
for (i=0; i < desc->n_intro_points; ++i) {
extend_info_t *info = desc->intro_point_extend_info[i];
int klen;
@@ -144,9 +144,9 @@ rend_parse_service_descriptor(const char *str, size_t len)
}
if (end-cp < 2) goto truncated;
result->n_intro_points = ntohs(get_uint16(cp));
-
cp += 2;
- if (version == 0) {
+
+ if (version == 0 && result->n_intro_points != 0) {
result->intro_points = tor_malloc_zero(sizeof(char*)*result->n_intro_points);
for (i=0;i<result->n_intro_points;++i) {
if (end-cp < 2) goto truncated;
@@ -155,7 +155,7 @@ rend_parse_service_descriptor(const char *str, size_t len)
result->intro_points[i] = tor_strdup(cp);
cp = eos+1;
}
- } else {
+ } else if (version != 0 && result->n_intro_points != 0) {
result->intro_point_extend_info =
tor_malloc_zero(sizeof(extend_info_t*)*result->n_intro_points);
result->intro_points = tor_malloc_zero(sizeof(char*)*result->n_intro_points);