[tor-commits] [arm/master] fix: skipping log parsing if misformatted

atagar at torproject.org atagar at torproject.org
Tue Jul 19 16:32:24 UTC 2011


commit dc04a95a054338957076b6b00d3813c731d61529
Author: Damian Johnson <atagar at torproject.org>
Date:   Tue Jul 19 09:29:56 2011 -0700

    fix: skipping log parsing if misformatted
    
    Prepopulating from Tor's log file can cause us to crash if the log file's
    misformatted. This can happen if either our log path has something other
    than a Tor log or in edge cases like running out of disk space. Caught by
    Sjon.
---
 src/cli/logPanel.py |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/cli/logPanel.py b/src/cli/logPanel.py
index 2e0d038..0b4ab9c 100644
--- a/src/cli/logPanel.py
+++ b/src/cli/logPanel.py
@@ -284,6 +284,13 @@ def getLogFileEntries(runlevels, readLimit = None, addLimit = None, config = Non
     # entries look like:
     # Jul 15 18:29:48.806 [notice] Parsing GEOIP file.
     lineComp = line.split()
+    
+    # Checks that we have all the components we expect. This could happen if
+    # we're either not parsing a tor log or in weird edge cases (like being
+    # out of disk space)
+    
+    if len(lineComp) < 4: continue
+    
     eventType = lineComp[3][1:-1].upper()
     
     if eventType in runlevels:



More information about the tor-commits mailing list