[tor-commits] [tor/master] Make sure callers can handle NULL ext-or auth cookie filename

nickm at torproject.org nickm at torproject.org
Wed Feb 19 18:55:40 UTC 2020


commit eb07166eb8aed3a37fe0e5ade476d7084bc0c5e4
Author: Nick Mathewson <nickm at torproject.org>
Date:   Tue Feb 18 12:55:57 2020 -0500

    Make sure callers can handle NULL ext-or auth cookie filename
---
 src/app/main/shutdown.c         | 3 ++-
 src/feature/client/transports.c | 6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/app/main/shutdown.c b/src/app/main/shutdown.c
index 27d92609e..aac15246b 100644
--- a/src/app/main/shutdown.c
+++ b/src/app/main/shutdown.c
@@ -75,7 +75,8 @@ tor_cleanup(void)
     /* Remove Extended ORPort cookie authentication file */
     {
       char *cookie_fname = get_ext_or_auth_cookie_file_name();
-      tor_remove_file(cookie_fname);
+      if (cookie_fname)
+        tor_remove_file(cookie_fname);
       tor_free(cookie_fname);
     }
     if (accounting_is_enabled(options))
diff --git a/src/feature/client/transports.c b/src/feature/client/transports.c
index a8ea9781a..55069bb60 100644
--- a/src/feature/client/transports.c
+++ b/src/feature/client/transports.c
@@ -1420,8 +1420,10 @@ create_managed_proxy_environment(const managed_proxy_t *mp)
         smartlist_add_asprintf(envs, "TOR_PT_EXTENDED_SERVER_PORT=%s",
                                ext_or_addrport_tmp);
       }
-      smartlist_add_asprintf(envs, "TOR_PT_AUTH_COOKIE_FILE=%s",
-                             cookie_file_loc);
+      if (cookie_file_loc) {
+        smartlist_add_asprintf(envs, "TOR_PT_AUTH_COOKIE_FILE=%s",
+                               cookie_file_loc);
+      }
 
       tor_free(ext_or_addrport_tmp);
       tor_free(cookie_file_loc);





More information about the tor-commits mailing list