Use tor_assertf{_nonfatal} in code

This commit is contained in:
rl1987 2019-03-05 17:58:31 +02:00 committed by Nick Mathewson
parent f66a17444e
commit a959d7cb98
3 changed files with 6 additions and 3 deletions

View File

@ -3117,7 +3117,9 @@ circuit_sent_valid_data(origin_circuit_t *circ, uint16_t relay_body_len)
{
if (!circ) return;
tor_assert_nonfatal(relay_body_len <= RELAY_PAYLOAD_SIZE);
tor_assertf_nonfatal(relay_body_len <= RELAY_PAYLOAD_SIZE,
"Wrong relay_body_len: %d (should be at most %d)",
relay_body_len, RELAY_PAYLOAD_SIZE);
circ->n_delivered_written_circ_bw =
tor_add_u32_nowrap(circ->n_delivered_written_circ_bw, relay_body_len);

View File

@ -46,7 +46,7 @@ crash(int x)
*(volatile int *)0 = 0;
#endif /* defined(__clang_analyzer__) || defined(__COVERITY__) */
} else if (crashtype == 1) {
tor_assert(1 == 0);
tor_assertf(1 == 0, "%d != %d", 1, 0);
} else if (crashtype == -1) {
;
}

View File

@ -448,7 +448,8 @@ static int next_key_idx_2048;
static crypto_pk_t *
pk_generate_internal(int bits)
{
tor_assert(bits == 2048 || bits == 1024);
tor_assertf(bits == 2048 || bits == 1024,
"Wrong key size: %d", bits);
#ifdef USE_PREGENERATED_RSA_KEYS
int *idxp;