aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app/config/config.c10
-rw-r--r--src/core/or/connection_edge.c2
-rw-r--r--src/lib/net/socks5_status.h1
3 files changed, 7 insertions, 6 deletions
diff --git a/src/app/config/config.c b/src/app/config/config.c
index 5b7b798549..e61281dac8 100644
--- a/src/app/config/config.c
+++ b/src/app/config/config.c
@@ -4858,6 +4858,7 @@ options_init_from_string(const char *cf_defaults, const char *cf,
newoptions->IncludeUsed = cf_has_include;
newoptions->FilesOpenedByIncludes = opened_files;
+ opened_files = NULL; // prevent double-free.
/* If this is a testing network configuration, change defaults
* for a list of dependent config options, and try this function again. */
@@ -4868,13 +4869,11 @@ options_init_from_string(const char *cf_defaults, const char *cf,
goto err;
}
- newoptions->IncludeUsed = cf_has_include;
- newoptions->FilesOpenedByIncludes = opened_files;
- opened_files = NULL; // prevent double-free.
-
err = options_validate_and_set(oldoptions, newoptions, msg);
- if (err < 0)
+ if (err < 0) {
+ newoptions = NULL; // This was already freed in options_validate_and_set.
goto err;
+ }
or_options_free(global_default_options);
global_default_options = newdefaultoptions;
@@ -4888,6 +4887,7 @@ options_init_from_string(const char *cf_defaults, const char *cf,
smartlist_free(opened_files);
}
or_options_free(newdefaultoptions);
+ or_options_free(newoptions);
if (*msg) {
char *old_msg = *msg;
tor_asprintf(msg, "Failed to parse/validate config: %s", old_msg);
diff --git a/src/core/or/connection_edge.c b/src/core/or/connection_edge.c
index 4b4bcff2f4..8ab9d7d26e 100644
--- a/src/core/or/connection_edge.c
+++ b/src/core/or/connection_edge.c
@@ -2123,7 +2123,7 @@ connection_ap_handshake_rewrite_and_attach(entry_connection_t *conn,
control_event_client_status(LOG_WARN, "SOCKS_BAD_HOSTNAME HOSTNAME=%s",
escaped(socks->address));
if (addresstype == ONION_V3_HOSTNAME) {
- conn->socks_request->socks_extended_error_code = SOCKS5_HS_IS_INVALID;
+ conn->socks_request->socks_extended_error_code = SOCKS5_HS_BAD_ADDRESS;
}
connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL);
return -1;
diff --git a/src/lib/net/socks5_status.h b/src/lib/net/socks5_status.h
index 47d9533d51..a2a479dd51 100644
--- a/src/lib/net/socks5_status.h
+++ b/src/lib/net/socks5_status.h
@@ -36,6 +36,7 @@ typedef enum {
SOCKS5_HS_REND_FAILED = 0xF3,
SOCKS5_HS_MISSING_CLIENT_AUTH = 0xF4,
SOCKS5_HS_BAD_CLIENT_AUTH = 0xF5,
+ SOCKS5_HS_BAD_ADDRESS = 0xF6,
} socks5_reply_status_t;
#endif /* !defined(TOR_SOCKS5_STATUS_H) */