diff options
author | David Goulet <dgoulet@torproject.org> | 2019-08-20 10:50:31 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-09-09 11:07:36 -0400 |
commit | 385f6bcfccbc327f42e5139ac8136086e79fbb17 (patch) | |
tree | 4269b817a32b88582b6e451e9d150ab3c299ac32 /src/test/test_hs_dos.c | |
parent | a8a1ea4e0e78e5a24fad6939c47ef9dbf78b38c2 (diff) | |
download | tor-385f6bcfccbc327f42e5139ac8136086e79fbb17.tar.gz tor-385f6bcfccbc327f42e5139ac8136086e79fbb17.zip |
hs-v3: Move DoS parameter check against 0
Move it outside of the validation function since 0 is a valid value but
disables defenses.
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/test/test_hs_dos.c')
-rw-r--r-- | src/test/test_hs_dos.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/test/test_hs_dos.c b/src/test/test_hs_dos.c index 25a04d779e..03c755acb1 100644 --- a/src/test/test_hs_dos.c +++ b/src/test/test_hs_dos.c @@ -143,6 +143,8 @@ test_validate_dos_extension_params(void *arg) /* Valid custom rate/burst. */ ret = validate_cell_dos_extension_parameters(17, 42); tt_assert(ret); + ret = cell_dos_extension_parameters_are_valid(INT32_MAX, INT32_MAX); + tt_assert(ret); /* Invalid rate. */ ret = validate_cell_dos_extension_parameters(UINT64_MAX, 42); @@ -152,11 +154,9 @@ test_validate_dos_extension_params(void *arg) ret = validate_cell_dos_extension_parameters(42, UINT64_MAX); tt_assert(!ret); - /* Value of 0 should return invalid so defenses can be disabled. */ - ret = validate_cell_dos_extension_parameters(0, 42); - tt_assert(!ret); - ret = validate_cell_dos_extension_parameters(42, 0); - tt_assert(!ret); + /* Value of 0 is valid (but should disable defenses) */ + ret = cell_dos_extension_parameters_are_valid(0, 0); + tt_assert(ret); /* Can't have burst smaller than rate. */ ret = validate_cell_dos_extension_parameters(42, 40); @@ -174,4 +174,3 @@ struct testcase_t hs_dos_tests[] = { END_OF_TESTCASES }; - |