aboutsummaryrefslogtreecommitdiff
path: root/src/or/rendservice.c
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 /src/or/rendservice.c
parent5d64ceb12defdc7db8402088fb2946c35274636a (diff)
downloadtor-965e3a6628f26d5fb1422fb04aa12e807537a32a.tar.gz
tor-965e3a6628f26d5fb1422fb04aa12e807537a32a.zip
prop224: Fix clang warnings
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/rendservice.c')
-rw-r--r--src/or/rendservice.c10
1 files changed, 9 insertions, 1 deletions
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. */