summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2016-02-06 22:17:02 +0100
committerPeter Palfrader <peter@palfrader.org>2016-02-06 22:17:02 +0100
commit42e131e9acca7c51fb220935deda5dc681004e3f (patch)
tree2cace5c81e896226d62d323b341884bfed20a0f5
parent2d879bd39febfcce9ce39f13c897951fee7d8784 (diff)
downloadtor-42e131e9acca7c51fb220935deda5dc681004e3f.tar.gz
tor-42e131e9acca7c51fb220935deda5dc681004e3f.zip
Fix a segfault during startup
If unix socket was configured as listener (such as a ControlSocket or a SocksPort unix socket), and tor was started as root but not configured to switch to another user, tor would segfault while trying to string compare a NULL value. Fixes bug 18261; bugfix on 0.2.8.1-alpha. Patch by weasel.
-rw-r--r--changes/bug182616
-rw-r--r--src/or/connection.c2
2 files changed, 7 insertions, 1 deletions
diff --git a/changes/bug18261 b/changes/bug18261
new file mode 100644
index 0000000000..df4c74f337
--- /dev/null
+++ b/changes/bug18261
@@ -0,0 +1,6 @@
+ o Minor features (crypto):
+ - Fix a segfault during startup: If unix socket was configured as
+ listener (such as a ControlSocket or a SocksPort unix socket), and
+ tor was started as root but not configured to switch to another
+ user, tor would segfault while trying to string compare a NULL
+ value. Fixes bug 18261; bugfix on 0.2.8.1-alpha. Patch by weasel.
diff --git a/src/or/connection.c b/src/or/connection.c
index 123c33a876..efd730f5d5 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -2398,7 +2398,7 @@ retry_listener_ports(smartlist_t *old_conns,
/* We don't need to be root to create a UNIX socket, so defer until after
* setuid. */
const or_options_t *options = get_options();
- if (port->is_unix_addr && !geteuid() && strcmp(options->User, "root"))
+ if (port->is_unix_addr && !geteuid() && (options->User) && strcmp(options->User, "root"))
continue;
#endif