summaryrefslogtreecommitdiff
path: root/src/or/connection.c
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2013-07-15 10:46:22 +0200
committerNick Mathewson <nickm@torproject.org>2013-07-15 09:04:17 -0400
commit783c52b6df5db152cf2a3b9f85756761a6c79777 (patch)
treec810d87ac08449b1d9f07f923f598f8061f670eb /src/or/connection.c
parent5cc52b242e5a4380e3aea6c53606f756d0a3a48a (diff)
downloadtor-783c52b6df5db152cf2a3b9f85756761a6c79777.tar.gz
tor-783c52b6df5db152cf2a3b9f85756761a6c79777.zip
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.
Diffstat (limited to 'src/or/connection.c')
-rw-r--r--src/or/connection.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index aa3cc330da..edcf966e75 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;