tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

commit 184d889f8ac7a004050a1d3d0c5981d6518410c0
parent f9615f9d770e035829e1ff238980d6ac6e852150
Author: Nick Mathewson <nickm@torproject.org>
Date:   Tue, 30 May 2017 08:47:14 -0400

Merge remote-tracking branch 'jigsaw/fix-22417-without-3-star'

Diffstat:
Msrc/common/confline.c | 25++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/src/common/confline.c b/src/common/confline.c @@ -19,7 +19,7 @@ static int config_get_included_list(const char *path, int recursion_level, int extended, config_line_t **list, config_line_t **list_last); static int config_process_include(const char *path, int recursion_level, - int extended, config_line_t ***next, + int extended, config_line_t **list, config_line_t **list_last); /** Helper: allocate a new configuration option mapping 'key' to 'val', @@ -132,7 +132,8 @@ config_get_lines_aux(const char *string, config_line_t **result, int extended, tor_free(k); include_used = 1; - if (config_process_include(v, recursion_level, extended, &next, + config_line_t *include_list; + if (config_process_include(v, recursion_level, extended, &include_list, &list_last) < 0) { log_warn(LD_CONFIG, "Error reading included configuration " "file or directory: \"%s\".", v); @@ -140,6 +141,9 @@ config_get_lines_aux(const char *string, config_line_t **result, int extended, tor_free(v); return -1; } + *next = include_list; + if (list_last) + next = &list_last->next; tor_free(v); } else { /* This list can get long, so we keep a pointer to the end of it @@ -262,14 +266,15 @@ config_get_included_list(const char *path, int recursion_level, int extended, return 0; } -/** Process an %include <b>path</b> in a config file. Set <b>next</b> to a - * pointer to the next pointer of the last element of the config_line_t list - * obtained from the config file and <b>list_last</b> to the last element of - * the same list. Return 0 on success, -1 on failure. */ +/** Process an %include <b>path</b> in a config file. Set <b>list</b> to the + * list of configuration settings obtained and <b>list_last</b> to the last + * element of the same list. Return 0 on success, -1 on failure. */ static int config_process_include(const char *path, int recursion_level, int extended, - config_line_t ***next, config_line_t **list_last) + config_line_t **list, config_line_t **list_last) { + config_line_t *ret_list = NULL; + config_line_t **next = &ret_list; #if 0 // Disabled -- we already unescape_string() on the result. */ char *unquoted_path = get_unquoted_path(path); @@ -299,11 +304,13 @@ config_process_include(const char *path, int recursion_level, int extended, } tor_free(config_file); - **next = included_list; - *next = &(*list_last)->next; + *next = included_list; + if (*list_last) + next = &(*list_last)->next; } SMARTLIST_FOREACH_END(config_file); smartlist_free(config_files); + *list = ret_list; return 0; }