commit 753a246a14a021dc3e4bc26c40d6fe7c2d60bb1b Author: Nick Mathewson nickm@torproject.org Date: Thu Mar 27 17:11:53 2014 -0400
check outputs from get_first_listener_addrport_string
Fix for 9650; bugfix for 0.2.3.16-alpha. --- changes/bug9650 | 4 ++++ src/or/transports.c | 12 ++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/changes/bug9650 b/changes/bug9650 new file mode 100644 index 0000000..c49cc24 --- /dev/null +++ b/changes/bug9650 @@ -0,0 +1,4 @@ + o Minor bugfixes: + - Avoid potential crashes or bad behavior when launching a + server-side managed proxy with ORPort or ExtORPort temporarily + disabled. Fixes bug 9650; bugfix on 0.2.3.16-alpha. diff --git a/src/or/transports.c b/src/or/transports.c index 8b4a118..7e496fe 100644 --- a/src/or/transports.c +++ b/src/or/transports.c @@ -1243,8 +1243,10 @@ create_managed_proxy_environment(const managed_proxy_t *mp) { char *orport_tmp = get_first_listener_addrport_string(CONN_TYPE_OR_LISTENER); - smartlist_add_asprintf(envs, "TOR_PT_ORPORT=%s", orport_tmp); - tor_free(orport_tmp); + if (orport_tmp) { + smartlist_add_asprintf(envs, "TOR_PT_ORPORT=%s", orport_tmp); + tor_free(orport_tmp); + } }
{ @@ -1275,8 +1277,10 @@ create_managed_proxy_environment(const managed_proxy_t *mp) get_first_listener_addrport_string(CONN_TYPE_EXT_OR_LISTENER); char *cookie_file_loc = get_ext_or_auth_cookie_file_name();
- smartlist_add_asprintf(envs, "TOR_PT_EXTENDED_SERVER_PORT=%s", - ext_or_addrport_tmp); + if (ext_or_addrport_tmp) { + 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);
tor-commits@lists.torproject.org