diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common/log.c | 6 | ||||
-rw-r--r-- | src/or/cpuworker.c | 3 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/common/log.c b/src/common/log.c index 2e7c711413..bbad7f1dac 100644 --- a/src/common/log.c +++ b/src/common/log.c @@ -1215,7 +1215,8 @@ log_level_to_string(int level) static const char *domain_list[] = { "GENERAL", "CRYPTO", "NET", "CONFIG", "FS", "PROTOCOL", "MM", "HTTP", "APP", "CONTROL", "CIRC", "REND", "BUG", "DIR", "DIRSERV", - "OR", "EDGE", "ACCT", "HIST", "HANDSHAKE", "HEARTBEAT", "CHANNEL", NULL + "OR", "EDGE", "ACCT", "HIST", "HANDSHAKE", "HEARTBEAT", "CHANNEL", + "SCHED", NULL }; /** Return a bitmask for the log domain for which <b>domain</b> is the name, @@ -1245,7 +1246,8 @@ domain_to_string(log_domain_mask_t domain, char *buf, size_t buflen) const char *d; int bit = tor_log2(domain); size_t n; - if (bit >= N_LOGGING_DOMAINS) { + if ((unsigned)bit >= ARRAY_LENGTH(domain_list)-1 || + bit >= N_LOGGING_DOMAINS) { tor_snprintf(buf, buflen, "<BUG:Unknown domain %lx>", (long)domain); return buf+strlen(buf); } diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c index 3ddb37a262..5e8b32d780 100644 --- a/src/or/cpuworker.c +++ b/src/or/cpuworker.c @@ -298,6 +298,7 @@ cpuworker_onion_handshake_replyfn(void *work_) cpuworker_reply_t rpl; or_circuit_t *circ = NULL; + tor_assert(total_pending_tasks > 0); --total_pending_tasks; /* Could avoid this, but doesn't matter. */ @@ -553,6 +554,8 @@ cpuworker_cancel_circ_handshake(or_circuit_t *circ) /* It successfully cancelled. */ memwipe(job, 0xe0, sizeof(*job)); tor_free(job); + tor_assert(total_pending_tasks > 0); + --total_pending_tasks; } circ->workqueue_entry = NULL; |