mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-23 20:03:31 +01:00
Avoid casting smartlist index implicitly
This commit is contained in:
parent
3716ddf1b4
commit
39bbb8d9cf
4
changes/bug26282
Normal file
4
changes/bug26282
Normal file
@ -0,0 +1,4 @@
|
||||
o Minor bugfixes (C correctness):
|
||||
- Avoid casting smartlist index to int implicitly, as it may trigger
|
||||
a warning (-Wshorten-64-to-32). Fixes bug 26282; bugfix on
|
||||
0.2.3.13-alpha, 0.2.7.1-alpha and 0.2.1.1-alpha.
|
@ -4813,7 +4813,7 @@ process_environment_make(struct smartlist_t *env_vars)
|
||||
|
||||
total_env_length = 1; /* terminating NUL of terminating empty string */
|
||||
for (i = 0; i < n_env_vars; ++i) {
|
||||
const char *s = smartlist_get(env_vars, i);
|
||||
const char *s = smartlist_get(env_vars, (int)i);
|
||||
size_t slen = strlen(s);
|
||||
|
||||
tor_assert(slen + 1 != 0);
|
||||
@ -4843,7 +4843,7 @@ process_environment_make(struct smartlist_t *env_vars)
|
||||
const char *prev_env_var = NULL;
|
||||
|
||||
for (i = 0; i < n_env_vars; ++i) {
|
||||
const char *s = smartlist_get(env_vars_sorted, i);
|
||||
const char *s = smartlist_get(env_vars_sorted, (int)i);
|
||||
size_t slen = strlen(s);
|
||||
size_t s_name_len = str_num_before(s, '=');
|
||||
|
||||
|
@ -4624,7 +4624,7 @@ handle_control_add_onion(control_connection_t *conn,
|
||||
static const char *max_s_prefix = "MaxStreams=";
|
||||
static const char *auth_prefix = "ClientAuth=";
|
||||
|
||||
const char *arg = smartlist_get(args, i);
|
||||
const char *arg = smartlist_get(args, (int)i);
|
||||
if (!strcasecmpstart(arg, port_prefix)) {
|
||||
/* "Port=VIRTPORT[,TARGET]". */
|
||||
const char *port_str = arg + strlen(port_prefix);
|
||||
|
@ -150,7 +150,7 @@ geoip_add_entry(const tor_addr_t *low, const tor_addr_t *high,
|
||||
idx = ((uintptr_t)idxplus1_)-1;
|
||||
}
|
||||
{
|
||||
geoip_country_t *c = smartlist_get(geoip_countries, idx);
|
||||
geoip_country_t *c = smartlist_get(geoip_countries, (int)idx);
|
||||
tor_assert(!strcasecmp(c->countrycode, country));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user