[or-cvs] r14006: Assert that severity in logv() is sane. Interesting effects (in tor/trunk: . src/common)
weasel at seul.org
weasel at seul.org
Thu Mar 13 16:56:15 UTC 2008
Author: weasel
Date: 2008-03-13 12:56:14 -0400 (Thu, 13 Mar 2008)
New Revision: 14006
Modified:
tor/trunk/ChangeLog
tor/trunk/src/common/log.c
Log:
Assert that severity in logv() is sane. Interesting effects otherwise (It is being used as an array index)
Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog 2008-03-13 16:15:16 UTC (rev 14005)
+++ tor/trunk/ChangeLog 2008-03-13 16:56:14 UTC (rev 14006)
@@ -20,6 +20,7 @@
614. Bugfix on 0.1.2.x.
- Make --enable-openbsd-malloc work correctly on Linux with alpha CPUs.
Fixes bug 625. Bugfix on 0.2.0.x.
+ - Logging functions now check that the passed severity is sane.
o Minor features:
- Allow separate log levels to be configured for different logging
Modified: tor/trunk/src/common/log.c
===================================================================
--- tor/trunk/src/common/log.c 2008-03-13 16:15:16 UTC (rev 14005)
+++ tor/trunk/src/common/log.c 2008-03-13 16:56:14 UTC (rev 14006)
@@ -261,6 +261,9 @@
/* 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) {
More information about the tor-commits
mailing list