commit 965e3a6628f26d5fb1422fb04aa12e807537a32a Author: David Goulet dgoulet@torproject.org Date: Thu Jul 13 17:18:11 2017 -0400
prop224: Fix clang warnings
Signed-off-by: David Goulet dgoulet@torproject.org --- src/or/hs_service.c | 3 ++- src/or/rendservice.c | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/or/hs_service.c b/src/or/hs_service.c index d8b87d1..5fde42d 100644 --- a/src/or/hs_service.c +++ b/src/or/hs_service.c @@ -80,9 +80,10 @@ HT_GENERATE2(hs_service_ht, hs_service_t, hs_service_node, STATIC hs_service_t * find_service(hs_service_ht *map, const ed25519_public_key_t *pk) { - hs_service_t dummy_service = {0}; + hs_service_t dummy_service; tor_assert(map); tor_assert(pk); + memset(&dummy_service, 0, sizeof(dummy_service)); ed25519_pubkey_copy(&dummy_service.keys.identity_pk, pk); return HT_FIND(hs_service_ht, map, &dummy_service); } diff --git a/src/or/rendservice.c b/src/or/rendservice.c index 67de636..2a5d2b7 100644 --- a/src/or/rendservice.c +++ b/src/or/rendservice.c @@ -18,6 +18,7 @@ #include "control.h" #include "directory.h" #include "hs_common.h" +#include "hs_config.h" #include "main.h" #include "networkstatus.h" #include "nodelist.h" @@ -631,7 +632,14 @@ service_config_shadow_copy(rend_service_t *service, service->directory = tor_strdup(config->directory_path); service->dir_group_readable = config->dir_group_readable; service->allow_unknown_ports = config->allow_unknown_ports; - service->max_streams_per_circuit = config->max_streams_per_rdv_circuit; + /* This value can't go above HS_CONFIG_MAX_STREAMS_PER_RDV_CIRCUIT (65535) + * if the code flow is right so this cast is safe. But just in case, we'll + * check it. */ + service->max_streams_per_circuit = (int) config->max_streams_per_rdv_circuit; + if (BUG(config->max_streams_per_rdv_circuit > + HS_CONFIG_MAX_STREAMS_PER_RDV_CIRCUIT)) { + service->max_streams_per_circuit = HS_CONFIG_MAX_STREAMS_PER_RDV_CIRCUIT; + } service->max_streams_close_circuit = config->max_streams_close_circuit; service->n_intro_points_wanted = config->num_intro_points; /* Switching ownership of the ports to the rend service object. */