diff options
author | Daniel Pinto <danielpinto52@gmail.com> | 2019-09-22 22:30:48 +0100 |
---|---|---|
committer | teor <teor@torproject.org> | 2019-09-23 10:39:08 +1000 |
commit | 15490816da0f8b651d67acef9c7f4e5bf9652ce2 (patch) | |
tree | 7c1b4fa536f5bae13996a9c79abe7622763374d0 /src/lib/fs | |
parent | 02840169d860384257042bdf6d7601c2bf48b47b (diff) | |
download | tor-15490816da0f8b651d67acef9c7f4e5bf9652ce2.tar.gz tor-15490816da0f8b651d67acef9c7f4e5bf9652ce2.zip |
Fix bug when %including folder with comment only files. #31408
When processing a %included folder, a bug caused the pointer to
the last element of the options list to be set to NULL when
processing a file with only comments or whitepace. This could
cause options from other files on the same folder to be
discarded depending on the lines after the affected %include.
Diffstat (limited to 'src/lib/fs')
-rw-r--r-- | src/lib/fs/conffile.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/fs/conffile.c b/src/lib/fs/conffile.c index 7bb2f23931..0d5d56b335 100644 --- a/src/lib/fs/conffile.c +++ b/src/lib/fs/conffile.c @@ -153,16 +153,18 @@ config_process_include(const char *path, int recursion_level, int extended, int rv = -1; SMARTLIST_FOREACH_BEGIN(config_files, const char *, config_file) { config_line_t *included_config = NULL; + config_line_t *included_config_last = NULL; if (config_get_included_config(config_file, recursion_level, extended, - &included_config, list_last, + &included_config, &included_config_last, opened_lst) < 0) { goto done; } *next = included_config; - if (*list_last) - next = &(*list_last)->next; - + if (included_config_last) { + next = &included_config_last->next; + *list_last = included_config_last; + } } SMARTLIST_FOREACH_END(config_file); *list = ret_list; rv = 0; |