aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorteor <teor2345@gmail.com>2015-06-03 03:58:28 +1000
committerteor <teor2345@gmail.com>2015-06-03 04:19:06 +1000
commit6d8a2ff24f18cc008d3c180a191f5040c7b2e2ba (patch)
tree22c512efd681ab0a3efd859a4af81f3cb7ce0b8d /src/or
parent383a27afc58b7a416fe0f30c80fdd069bc03d5d4 (diff)
downloadtor-6d8a2ff24f18cc008d3c180a191f5040c7b2e2ba.tar.gz
tor-6d8a2ff24f18cc008d3c180a191f5040c7b2e2ba.zip
Check for NULL values in getinfo_helper_onions
Fix on 915c7438a77e in Tor 0.2.7.1-alpha.
Diffstat (limited to 'src/or')
-rw-r--r--src/or/control.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/or/control.c b/src/or/control.c
index 2eaad4e373..7a113f2c1c 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -2193,7 +2193,7 @@ getinfo_helper_onions(control_connection_t *control_conn,
{
smartlist_t *onion_list = NULL;
- if (!strcmp(question, "onions/current")) {
+ if (control_conn && !strcmp(question, "onions/current")) {
onion_list = control_conn->ephemeral_onion_services;
} else if (!strcmp(question, "onions/detached")) {
onion_list = detached_onion_services;
@@ -2201,10 +2201,14 @@ getinfo_helper_onions(control_connection_t *control_conn,
return 0;
}
if (!onion_list || smartlist_len(onion_list) == 0) {
- *errmsg = "No onion services of the specified type.";
+ if (errmsg) {
+ *errmsg = "No onion services of the specified type.";
+ }
return -1;
}
- *answer = smartlist_join_strings(onion_list, "\r\n", 0, NULL);
+ if (answer) {
+ *answer = smartlist_join_strings(onion_list, "\r\n", 0, NULL);
+ }
return 0;
}