]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Make sure callers can handle NULL ext-or auth cookie filename
authorNick Mathewson <nickm@torproject.org>
Tue, 18 Feb 2020 17:55:57 +0000 (12:55 -0500)
committerNick Mathewson <nickm@torproject.org>
Tue, 18 Feb 2020 17:55:57 +0000 (12:55 -0500)
src/app/main/shutdown.c
src/feature/client/transports.c

index 27d92609eb69055d6058ff98f1f96898fec99937..aac15246b937dab4a9119ffdabafec6bad3ea519 100644 (file)
@@ -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))
index a8ea9781a4ddd225c6edaadca74fcb8952023a42..55069bb60a082c40d7cc8cdff4f51ec7a4df1645 100644 (file)
@@ -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);