]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Avoid crash on failure to read FamilyKeyDir
authorNick Mathewson <nickm@torproject.org>
Mon, 28 Apr 2025 16:29:05 +0000 (12:29 -0400)
committerNick Mathewson <nickm@torproject.org>
Mon, 28 Apr 2025 16:29:59 +0000 (12:29 -0400)
Previously we could try to iterate over `files`
even if it were NULL.

Fixes bug #41043; bugfix on 0.4.9.2-alpha.

changes/bug41043 [new file with mode: 0644]
src/feature/relay/routerkeys.c

diff --git a/changes/bug41043 b/changes/bug41043
new file mode 100644 (file)
index 0000000..f0c2892
--- /dev/null
@@ -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.
index 9f956ee6b4c892d8b45efeeb493f8e8d44beede4..31a57b75bf7e2e45572a89dfb7606cf21dd2432d 100644 (file)
@@ -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;
 }