[Turqstat-commits] [SCM] Turquoise SuperStat - http://www.softwolves.pp.se/sw/software/turquoise branch, xturqstat-win32, updated. release-3.0-2-24-g32a20f2

Peter Karlsson peter at softwolves.pp.se
Mon Jun 2 19:17:56 UTC 2008


The following commit has been merged in the xturqstat-win32 branch:
commit 32a20f2fcdf802a7caf9fa968e143f8e5a36c4ea
Author: Peter Karlsson <peter at softwolves.pp.se>
Date:   Mon Jun 2 21:02:29 2008 +0200

    Fixed out-of-bounds access for program names without spaces.
    
    If the string has no spaces, "firstspace" is set to the length of the
    string. We must make sure not to access the "firstspace + 1"th position
    of the string then.

diff --git a/ChangeLog b/ChangeLog
index c6df20b..3575eff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,9 @@
   qtreport.cpp
     Porting to Qt 4.
 
+  statengine.cpp
+    Fixed out-of-bounds access for program names without spaces.
+
   utility.cpp
     Workaround for WinAPI problems.
 
diff --git a/statengine.cpp b/statengine.cpp
index 63dd3dd..c7810e1 100644
--- a/statengine.cpp
+++ b/statengine.cpp
@@ -741,7 +741,7 @@ void StatEngine::AddData(string in_fromname, string in_toname, string in_subject
         if (paren != string::npos && paren < space1) space1 = paren;
 
         // Special case: "Gnus v#.##/Emacs..."
-		if (firstspace && 'v' == program[firstspace + 1] &&
+		if (firstspace && firstspace < program.length() && 'v' == program[firstspace + 1] &&
             isdigit(program[firstspace + 2]))
             space1 = firstspace;
 

-- 
Turquoise SuperStat - http://www.softwolves.pp.se/sw/software/turquoise



More information about the Turqstat-commits mailing list