Merge branch 'maint-0.3.2'

This commit is contained in:
Nick Mathewson 2017-12-11 16:43:51 -05:00
commit d5400d50e7
5 changed files with 15 additions and 30 deletions

5
changes/bug23682 Normal file
View File

@ -0,0 +1,5 @@
o Minor bugfixes (entry guards):
- Tor now updates its guard state when it reads a consensus regardless of
whether it's missing descriptors. That makes tor use its primary guards
to fetch descriptors in some edge cases where it would have used fallback
directories in the past. Fixes bug 23862; bugfix on 0.3.0.1-alpha.

7
changes/stack Normal file
View File

@ -0,0 +1,7 @@
o Minor bugfixes (correctness):
- Fix several places in our codebase where a C compiler would be likely
to eliminate a check, based on assuming that undefined behavior had not
happened elsewhere in the code. These cases are usually a sign of
redundant checking, or dubious arithmetic. Found by Georg Koppen using
the "STACK" tool from Wang, Zeldovich, Kaashoek, and
Solar-Lezama. Fixes bug 24423; bugfix on various Tor versions.

View File

@ -1394,10 +1394,6 @@ sandbox_cfg_allow_stat_filename(sandbox_cfg_t **cfg, char *file)
sandbox_cfg_t *elem = NULL; sandbox_cfg_t *elem = NULL;
elem = new_element(SCMP_stat, file); elem = new_element(SCMP_stat, file);
if (!elem) {
log_err(LD_BUG,"(Sandbox) failed to register parameter!");
return -1;
}
elem->next = *cfg; elem->next = *cfg;
*cfg = elem; *cfg = elem;
@ -1411,10 +1407,6 @@ sandbox_cfg_allow_open_filename(sandbox_cfg_t **cfg, char *file)
sandbox_cfg_t *elem = NULL; sandbox_cfg_t *elem = NULL;
elem = new_element(SCMP_SYS(open), file); elem = new_element(SCMP_SYS(open), file);
if (!elem) {
log_err(LD_BUG,"(Sandbox) failed to register parameter!");
return -1;
}
elem->next = *cfg; elem->next = *cfg;
*cfg = elem; *cfg = elem;
@ -1428,10 +1420,6 @@ sandbox_cfg_allow_chmod_filename(sandbox_cfg_t **cfg, char *file)
sandbox_cfg_t *elem = NULL; sandbox_cfg_t *elem = NULL;
elem = new_element(SCMP_SYS(chmod), file); elem = new_element(SCMP_SYS(chmod), file);
if (!elem) {
log_err(LD_BUG,"(Sandbox) failed to register parameter!");
return -1;
}
elem->next = *cfg; elem->next = *cfg;
*cfg = elem; *cfg = elem;
@ -1445,10 +1433,6 @@ sandbox_cfg_allow_chown_filename(sandbox_cfg_t **cfg, char *file)
sandbox_cfg_t *elem = NULL; sandbox_cfg_t *elem = NULL;
elem = new_element(SCMP_SYS(chown), file); elem = new_element(SCMP_SYS(chown), file);
if (!elem) {
log_err(LD_BUG,"(Sandbox) failed to register parameter!");
return -1;
}
elem->next = *cfg; elem->next = *cfg;
*cfg = elem; *cfg = elem;
@ -1463,11 +1447,6 @@ sandbox_cfg_allow_rename(sandbox_cfg_t **cfg, char *file1, char *file2)
elem = new_element2(SCMP_SYS(rename), file1, file2); elem = new_element2(SCMP_SYS(rename), file1, file2);
if (!elem) {
log_err(LD_BUG,"(Sandbox) failed to register parameter!");
return -1;
}
elem->next = *cfg; elem->next = *cfg;
*cfg = elem; *cfg = elem;
@ -1480,10 +1459,6 @@ sandbox_cfg_allow_openat_filename(sandbox_cfg_t **cfg, char *file)
sandbox_cfg_t *elem = NULL; sandbox_cfg_t *elem = NULL;
elem = new_element(SCMP_SYS(openat), file); elem = new_element(SCMP_SYS(openat), file);
if (!elem) {
log_err(LD_BUG,"(Sandbox) failed to register parameter!");
return -1;
}
elem->next = *cfg; elem->next = *cfg;
*cfg = elem; *cfg = elem;

View File

@ -1814,7 +1814,7 @@ static time_t last_prediction_add_time=0;
int int
predicted_ports_prediction_time_remaining(time_t now) predicted_ports_prediction_time_remaining(time_t now)
{ {
time_t idle_delta = now - last_prediction_add_time; time_t idle_delta;
/* Protect against overflow of return value. This can happen if the clock /* Protect against overflow of return value. This can happen if the clock
* jumps backwards in time. Update the last prediction time (aka last * jumps backwards in time. Update the last prediction time (aka last
@ -1824,6 +1824,8 @@ predicted_ports_prediction_time_remaining(time_t now)
if (last_prediction_add_time > now) { if (last_prediction_add_time > now) {
last_prediction_add_time = now; last_prediction_add_time = now;
idle_delta = 0; idle_delta = 0;
} else {
idle_delta = now - last_prediction_add_time;
} }
/* Protect against underflow of the return value. This can happen for very /* Protect against underflow of the return value. This can happen for very

View File

@ -1094,8 +1094,6 @@ parse_smethod_line(const char *line, managed_proxy_t *mp)
transport = transport_new(&tor_addr, port, method_name, transport = transport_new(&tor_addr, port, method_name,
PROXY_NONE, args_string); PROXY_NONE, args_string);
if (!transport)
goto err;
smartlist_add(mp->transports, transport); smartlist_add(mp->transports, transport);
@ -1186,8 +1184,6 @@ parse_cmethod_line(const char *line, managed_proxy_t *mp)
} }
transport = transport_new(&tor_addr, port, method_name, socks_ver, NULL); transport = transport_new(&tor_addr, port, method_name, socks_ver, NULL);
if (!transport)
goto err;
smartlist_add(mp->transports, transport); smartlist_add(mp->transports, transport);