mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-23 22:47:12 +01:00
r12769@catbus: nickm | 2007-05-16 17:32:01 -0400
Fix warnings from -Wunsafe-loop-optimizations, which incidentally turned up a logic bug in connection_or_flush_from_first_active_circuit that would overcount the number of cells flushed. svn:r10199
This commit is contained in:
parent
b837191fd0
commit
807adfc879
2 changed files with 3 additions and 5 deletions
|
@ -1494,14 +1494,12 @@ crypto_expand_key_material(const char *key_in, size_t key_in_len,
|
|||
tor_assert(key_out_len <= DIGEST_LEN*256);
|
||||
|
||||
memcpy(tmp, key_in, key_in_len);
|
||||
for (cp = key_out, i=0; key_out_len; ++i, cp += DIGEST_LEN) {
|
||||
for (cp = key_out, i=0; key_out_len >= DIGEST_LEN;
|
||||
++i, cp += DIGEST_LEN, key_out_len -= DIGEST_LEN) {
|
||||
tmp[key_in_len] = i;
|
||||
if (crypto_digest(digest, tmp, key_in_len+1))
|
||||
goto err;
|
||||
memcpy(cp, digest, MIN(DIGEST_LEN, key_out_len));
|
||||
if (key_out_len < DIGEST_LEN)
|
||||
break;
|
||||
key_out_len -= DIGEST_LEN;
|
||||
}
|
||||
memset(tmp, 0, key_in_len+1);
|
||||
tor_free(tmp);
|
||||
|
|
|
@ -1807,7 +1807,7 @@ connection_or_flush_from_first_active_circuit(or_connection_t *conn, int max)
|
|||
}
|
||||
tor_assert(*next_circ_on_conn_p(circ,conn));
|
||||
|
||||
for (n_flushed = 0; n_flushed < max && queue->head; ++n_flushed) {
|
||||
for (n_flushed = 0; n_flushed < max && queue->head; ) {
|
||||
packed_cell_t *cell = cell_queue_pop(queue);
|
||||
tor_assert(*next_circ_on_conn_p(circ,conn));
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue