aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2017-07-13 17:18:11 -0400
committerDavid Goulet <dgoulet@torproject.org>2017-07-13 17:18:11 -0400
commit965e3a6628f26d5fb1422fb04aa12e807537a32a (patch)
tree48b4bc2b8da9f2ccacabc941aab8073c791d59c6
parent5d64ceb12defdc7db8402088fb2946c35274636a (diff)
downloadtor-965e3a6628f26d5fb1422fb04aa12e807537a32a.tar.gz
tor-965e3a6628f26d5fb1422fb04aa12e807537a32a.zip
prop224: Fix clang warnings
Signed-off-by: David Goulet <dgoulet@torproject.org>
-rw-r--r--src/or/hs_service.c3
-rw-r--r--src/or/rendservice.c10
2 files changed, 11 insertions, 2 deletions
diff --git a/src/or/hs_service.c b/src/or/hs_service.c
index d8b87d1f2c..5fde42ddbb 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 67de636de4..2a5d2b775c 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. */