diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-09-10 18:59:10 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-09-10 19:01:32 -0400 |
commit | 9d604959036bd02e7ff0ca1bd33f842664610b82 (patch) | |
tree | a0a927cab485419a47f1f277043efe7c12537af4 /src/test/test_confparse.c | |
parent | 796a9b37ea346f413f6684505ca31879ddf3f0f1 (diff) | |
download | tor-9d604959036bd02e7ff0ca1bd33f842664610b82.tar.gz tor-9d604959036bd02e7ff0ca1bd33f842664610b82.zip |
Use strtod, not atof, for parsing doubles in the configuration.
This lets us detect erroneous doubles, which previously we could not
do.
Fixes bug 31475; bugfix on commit 00a9e3732e88, a.k.a svn:r136.
Diffstat (limited to 'src/test/test_confparse.c')
-rw-r--r-- | src/test/test_confparse.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/test/test_confparse.c b/src/test/test_confparse.c index bd2b5cdf1b..a4da6c7c9f 100644 --- a/src/test/test_confparse.c +++ b/src/test/test_confparse.c @@ -488,6 +488,8 @@ test_confparse_assign_badval(void *arg) static const badval_test_t bv_notint = { "pos X\n", "malformed" }; static const badval_test_t bv_negint = { "pos -10\n", "out of bounds" }; static const badval_test_t bv_badu64 = { "u64 u64\n", "malformed" }; +static const badval_test_t bv_dbl1 = { "dbl xxx\n", "Could not convert" }; +static const badval_test_t bv_dbl2 = { "dbl 1.0 xx\n", "Could not convert" }; static const badval_test_t bv_badcsvi1 = { "csv_interval 10 wl\n", "malformed" }; static const badval_test_t bv_badcsvi2 = @@ -1045,6 +1047,8 @@ struct testcase_t confparse_tests[] = { BADVAL_TEST(notint), BADVAL_TEST(negint), BADVAL_TEST(badu64), + BADVAL_TEST(dbl1), + BADVAL_TEST(dbl2), BADVAL_TEST(badcsvi1), BADVAL_TEST(badcsvi2), BADVAL_TEST(nonoption), |