aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2008-03-13 16:56:14 +0000
committerPeter Palfrader <peter@palfrader.org>2008-03-13 16:56:14 +0000
commite6b2d119e893031cb3cc83b5e65c9e04272376bf (patch)
treead3a4b87c39ac403274e11a2420ecb019b57fa7f /src/common
parent925ba96508c4914f536d9075f192b9d62c1d1a2f (diff)
downloadtor-e6b2d119e893031cb3cc83b5e65c9e04272376bf.tar
tor-e6b2d119e893031cb3cc83b5e65c9e04272376bf.tar.gz
Assert that severity in logv() is sane. Interesting effects otherwise (It is being used as an array index)
svn:r14006
Diffstat (limited to 'src/common')
-rw-r--r--src/common/log.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/common/log.c b/src/common/log.c
index 1f541d976..e169a3f6c 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -261,6 +261,9 @@ logv(int severity, log_domain_mask_t domain, const char *funcname,
/* Call assert, not tor_assert, since tor_assert calls log on failure. */
assert(format);
+ /* check that severity is sane. Overrunning the masks array leads to
+ * interesting and hard to diagnose effects */
+ assert(severity >= LOG_ERR && severity <= LOG_DEBUG);
LOCK_LOGS();
lf = logfiles;
while (lf) {