[tor-commits] [tor/master] Reject relative control socket paths and emit a warning.

nickm at torproject.org nickm at torproject.org
Mon Jul 15 13:05:05 UTC 2013


commit 783c52b6df5db152cf2a3b9f85756761a6c79777
Author: Peter Palfrader <peter at palfrader.org>
Date:   Mon Jul 15 10:46:22 2013 +0200

    Reject relative control socket paths and emit a warning.
    
    Previously we would accept relative paths, but only if they contained a
    slash somewhere (not at the end).
    
    Otherwise we would silently not work.  Closes: #9258.  Bugfix on
    0.2.3.16-alpha.
---
 src/or/connection.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/or/connection.c b/src/or/connection.c
index aa3cc33..edcf966 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -877,8 +877,11 @@ check_location_for_unix_socket(const or_options_t *options, const char *path)
   int r = -1;
   char *p = tor_strdup(path);
   cpd_check_t flags = CPD_CHECK_MODE_ONLY;
-  if (get_parent_directory(p)<0)
+  if (get_parent_directory(p)<0 || p[0] != '/') {
+    log_warn(LD_GENERAL, "Bad unix socket address '%s'.  Tor does not support "
+             "relative patchs for unix sockets.", path);
     goto done;
+  }
 
   if (options->ControlSocketsGroupWritable)
     flags |= CPD_GROUP_OK;





More information about the tor-commits mailing list