aboutsummaryrefslogtreecommitdiff
path: root/src/or/config.c
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@fscked.org>2013-01-30 22:21:36 -0400
committerNick Mathewson <nickm@torproject.org>2013-02-01 17:01:22 -0500
commit95d272f5d843b0b8d30e183444b78910e72b04f7 (patch)
tree564d9b642f86a86cc2dd4a607e7e4ef2c056b281 /src/or/config.c
parentbce6714f99df6fd00c90918ac0a7407bf1f764e3 (diff)
downloadtor-95d272f5d843b0b8d30e183444b78910e72b04f7.tar
tor-95d272f5d843b0b8d30e183444b78910e72b04f7.tar.gz
Bounds-check path bias rate parameters.
The other remaining parameters don't really need range checks.
Diffstat (limited to 'src/or/config.c')
-rw-r--r--src/or/config.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/or/config.c b/src/or/config.c
index 70d87034a..2ba9c7672 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -2649,6 +2649,37 @@ options_validate(or_options_t *old_options, or_options_t *options,
RECOMMENDED_MIN_CIRCUIT_BUILD_TIMEOUT );
}
+ if (options->PathBiasNoticeRate > 1.0) {
+ tor_asprintf(msg,
+ "PathBiasNoticeRate is too high. "
+ "It must be between 0 and 1.0");
+ return -1;
+ }
+ if (options->PathBiasWarnRate > 1.0) {
+ tor_asprintf(msg,
+ "PathBiasWarnRate is too high. "
+ "It must be between 0 and 1.0");
+ return -1;
+ }
+ if (options->PathBiasExtremeRate > 1.0) {
+ tor_asprintf(msg,
+ "PathBiasExtremeRate is too high. "
+ "It must be between 0 and 1.0");
+ return -1;
+ }
+ if (options->PathBiasNoticeUseRate > 1.0) {
+ tor_asprintf(msg,
+ "PathBiasNoticeUseRate is too high. "
+ "It must be between 0 and 1.0");
+ return -1;
+ }
+ if (options->PathBiasExtremeUseRate > 1.0) {
+ tor_asprintf(msg,
+ "PathBiasExtremeUseRate is too high. "
+ "It must be between 0 and 1.0");
+ return -1;
+ }
+
if (options->MaxCircuitDirtiness < MIN_MAX_CIRCUIT_DIRTINESS) {
log_warn(LD_CONFIG, "MaxCircuitDirtiness option is too short; "
"raising to %d seconds.", MIN_MAX_CIRCUIT_DIRTINESS);