mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
Fix invalid-read when a managed proxy configuration fails.
This commit is contained in:
parent
dd44ff663e
commit
6e40806025
4
changes/bug9288
Normal file
4
changes/bug9288
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
o Minor bugfixes:
|
||||||
|
- Fix an invalid memory read that occured when a pluggable
|
||||||
|
transport proxy failed its configuration protocol.
|
||||||
|
Fixes bug 9288.
|
@ -106,7 +106,7 @@ static void managed_proxy_destroy(managed_proxy_t *mp,
|
|||||||
int also_terminate_process);
|
int also_terminate_process);
|
||||||
|
|
||||||
static void handle_finished_proxy(managed_proxy_t *mp);
|
static void handle_finished_proxy(managed_proxy_t *mp);
|
||||||
static void configure_proxy(managed_proxy_t *mp);
|
static int configure_proxy(managed_proxy_t *mp);
|
||||||
|
|
||||||
static void parse_method_error(const char *line, int is_server_method);
|
static void parse_method_error(const char *line, int is_server_method);
|
||||||
#define parse_server_method_error(l) parse_method_error(l, 1)
|
#define parse_server_method_error(l) parse_method_error(l, 1)
|
||||||
@ -573,10 +573,8 @@ pt_configure_remaining_proxies(void)
|
|||||||
/* If the proxy is not fully configured, try to configure it
|
/* If the proxy is not fully configured, try to configure it
|
||||||
futher. */
|
futher. */
|
||||||
if (!proxy_configuration_finished(mp))
|
if (!proxy_configuration_finished(mp))
|
||||||
configure_proxy(mp);
|
if (configure_proxy(mp) == 1)
|
||||||
|
at_least_a_proxy_config_finished = 1;
|
||||||
if (proxy_configuration_finished(mp))
|
|
||||||
at_least_a_proxy_config_finished = 1;
|
|
||||||
|
|
||||||
} SMARTLIST_FOREACH_END(mp);
|
} SMARTLIST_FOREACH_END(mp);
|
||||||
|
|
||||||
@ -588,10 +586,14 @@ pt_configure_remaining_proxies(void)
|
|||||||
mark_my_descriptor_dirty("configured managed proxies");
|
mark_my_descriptor_dirty("configured managed proxies");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Attempt to continue configuring managed proxy <b>mp</b>. */
|
/** Attempt to continue configuring managed proxy <b>mp</b>.
|
||||||
static void
|
* Return 1 if the transport configuration finished, and return 0
|
||||||
|
* otherwise (if we still have more configuring to do for this
|
||||||
|
* proxy). */
|
||||||
|
static int
|
||||||
configure_proxy(managed_proxy_t *mp)
|
configure_proxy(managed_proxy_t *mp)
|
||||||
{
|
{
|
||||||
|
int configuration_finished = 0;
|
||||||
smartlist_t *proxy_output = NULL;
|
smartlist_t *proxy_output = NULL;
|
||||||
enum stream_status stream_status = 0;
|
enum stream_status stream_status = 0;
|
||||||
|
|
||||||
@ -601,7 +603,7 @@ configure_proxy(managed_proxy_t *mp)
|
|||||||
mp->conf_state = PT_PROTO_FAILED_LAUNCH;
|
mp->conf_state = PT_PROTO_FAILED_LAUNCH;
|
||||||
handle_finished_proxy(mp);
|
handle_finished_proxy(mp);
|
||||||
}
|
}
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
tor_assert(mp->conf_state != PT_PROTO_INFANT);
|
tor_assert(mp->conf_state != PT_PROTO_INFANT);
|
||||||
@ -633,13 +635,17 @@ configure_proxy(managed_proxy_t *mp)
|
|||||||
|
|
||||||
done:
|
done:
|
||||||
/* if the proxy finished configuring, exit the loop. */
|
/* if the proxy finished configuring, exit the loop. */
|
||||||
if (proxy_configuration_finished(mp))
|
if (proxy_configuration_finished(mp)) {
|
||||||
handle_finished_proxy(mp);
|
handle_finished_proxy(mp);
|
||||||
|
configuration_finished = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (proxy_output) {
|
if (proxy_output) {
|
||||||
SMARTLIST_FOREACH(proxy_output, char *, cp, tor_free(cp));
|
SMARTLIST_FOREACH(proxy_output, char *, cp, tor_free(cp));
|
||||||
smartlist_free(proxy_output);
|
smartlist_free(proxy_output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return configuration_finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Register server managed proxy <b>mp</b> transports to state */
|
/** Register server managed proxy <b>mp</b> transports to state */
|
||||||
|
Loading…
Reference in New Issue
Block a user