commit 0299dc4aa1e710604098f7d12b37f1a4d24fa38c
parent 79ae64f1e91bb3d291a2fa6312622e52a0bd6dd4
Author: Alexander Hansen Færøy <ahf@torproject.org>
Date: Tue, 6 May 2025 22:01:53 +0200
Merge branch 'bug41043' into 'main'
Avoid crash on failure to read FamilyKeyDir
See merge request tpo/core/tor!886
Diffstat:
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/changes/bug41043 b/changes/bug41043
@@ -0,0 +1,3 @@
+ o Minor bugfixes (relay):
+ - Fix a crash when FamilyKeyDir is a path that cannot be read.
+ Fixes bug 41043; bugfix on 0.4.9.2-alpha.
diff --git a/src/feature/relay/routerkeys.c b/src/feature/relay/routerkeys.c
@@ -761,8 +761,10 @@ list_family_key_files_impl(const char *keydir)
SMARTLIST_FOREACH(result, char *, cp, tor_free(cp));
smartlist_free(result); // sets result to NULL.
done:
- SMARTLIST_FOREACH(files, char *, cp, tor_free(cp));
- smartlist_free(files);
+ if (files) {
+ SMARTLIST_FOREACH(files, char *, cp, tor_free(cp));
+ smartlist_free(files);
+ }
return result;
}