[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Routerset config parsing: represent empty sets as NULL.
commit 2074fed6642713bcdfdc76f379956e97663ab8d0
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Wed Aug 28 11:51:16 2019 -0400
Routerset config parsing: represent empty sets as NULL.
routerset_t has two representations of an empty routerset: NULL, and
a set containing no elements. But some of our config code assumes
that empty routersets are represented as NULL. So let's give it
what it assumes.
Fixes bug 31495. Bugfix on e16b90b88a76; but not in any released
Tor.
---
src/feature/nodelist/routerset.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/feature/nodelist/routerset.c b/src/feature/nodelist/routerset.c
index 76777847e..12965ad0d 100644
--- a/src/feature/nodelist/routerset.c
+++ b/src/feature/nodelist/routerset.c
@@ -479,6 +479,10 @@ routerset_kv_parse(void *target, const config_line_t *line, char **errmsg,
*errmsg = tor_strdup("Invalid router list.");
return -1;
} else {
+ if (routerset_is_empty(rs)) {
+ /* Represent empty sets as NULL. */
+ routerset_free(rs);
+ }
*p = rs;
return 0;
}
@@ -507,8 +511,10 @@ routerset_copy(void *dest, const void *src, const void *params)
routerset_t **output = (routerset_t**)dest;
const routerset_t *input = *(routerset_t**)src;
routerset_free(*output); // sets *output to NULL
- *output = routerset_new();
- routerset_union(*output, input);
+ if (! routerset_is_empty(input)) {
+ *output = routerset_new();
+ routerset_union(*output, input);
+ }
return 0;
}
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits