[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE
From:       Rolf Eike Beer <kde () opensource ! sf-tec ! de>
Date:       2009-06-25 21:58:17
Message-ID: 1245967097.997322.18509.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 987360 by dakon:

make sure not to access beyond end of list

Many thanks to Michael Hoeller for testing this with me.

BUG:197388


 M  +10 -16    4.2/kdeutils/kgpg/kgpginterface.cpp  
 M  +11 -16    4.3/kdeutils/kgpg/kgpginterface.cpp  


--- branches/KDE/4.2/kdeutils/kgpg/kgpginterface.cpp #987359:987360
@@ -526,10 +526,7 @@
                 m_publickey.setExpiration(QDateTime::fromTime_t(lsp.at(6).toUInt()).date());
  }
 
-            if (lsp.at(11).contains("D", Qt::CaseSensitive))  // disabled key
-                m_publickey.setValid(false);
-            else
-                m_publickey.setValid(true);
+            m_publickey.setValid((items <= 11) || !lsp.at(11).contains('D', \
Qt::CaseSensitive));  // disabled key  
             cycle = "pub";
 
@@ -554,16 +551,16 @@
             sub.setCreation(QDateTime::fromTime_t(lsp.at(5).toUInt()).date());
 
             // FIXME: Please see kgpgkey.h, KgpgSubKey class
-            if (lsp.at(11).contains('D'))
-                sub.setValid(false);
-            else
+            if (items <= 11) {
                 sub.setValid(true);
+            } else {
+                sub.setValid(!lsp.at(11).contains('D'));
 
-            if (lsp.at(11).contains('s'))
-                sub.setType(SKT_SIGNATURE);
-            else
-            if (lsp.at(11).contains('e'))
-                sub.setType(SKT_ENCRYPTION);
+                if (lsp.at(11).contains('s'))
+                    sub.setType(SKT_SIGNATURE);
+                else if (lsp.at(11).contains('e'))
+                    sub.setType(SKT_ENCRYPTION);
+            }
 
             if (lsp.at(6).isEmpty())
             {
@@ -631,10 +628,7 @@
 			uid.setComment(comment);
 			uid.setName(kname);
 			uid.setTrust(Convert::toTrust(lsp.at(1)));
-			if ((items > 11) && lsp.at(11).contains('D'))
-				uid.setValid(false);
-			else
-				uid.setValid(true);
+			uid.setValid((items <= 11) || !lsp.at(11).contains('D'));
 
 			uid.setIndex(++m_numberid);
 
--- branches/KDE/4.3/kdeutils/kgpg/kgpginterface.cpp #987359:987360
@@ -474,10 +474,7 @@
 			else
 				m_publickey.setExpiration(QDateTime::fromTime_t(lsp.at(6).toUInt()).date());
 
-			if (lsp.at(11).contains("D", Qt::CaseSensitive))  // disabled key
-				m_publickey.setValid(false);
-			else
-				m_publickey.setValid(true);
+			m_publickey.setValid((items <= 11) || !lsp.at(11).contains('D', \
Qt::CaseSensitive));  // disabled key  
 			cycle = "pub";
 
@@ -496,16 +493,17 @@
 			sub.setCreation(QDateTime::fromTime_t(lsp.at(5).toUInt()).date());
 
 			// FIXME: Please see kgpgkey.h, KgpgSubKey class
-			if (lsp.at(11).contains('D'))
-				sub.setValid(false);
-			else
+			if (items <= 11) {
 				sub.setValid(true);
+			} else {
+				sub.setValid(!lsp.at(11).contains('D'));
 
-			if (lsp.at(11).contains('s'))
-				sub.setType(SKT_SIGNATURE);
-			else
-			if (lsp.at(11).contains('e'))
-				sub.setType(SKT_ENCRYPTION);
+				if (lsp.at(11).contains('s'))
+					sub.setType(SKT_SIGNATURE);
+				else
+				if (lsp.at(11).contains('e'))
+					sub.setType(SKT_ENCRYPTION);
+			}
 
 			if (lsp.at(6).isEmpty())
 				sub.setExpiration(QDate());
@@ -561,10 +559,7 @@
 				uid.setComment(comment);
 				uid.setName(kname);
 				uid.setTrust(Convert::toTrust(lsp.at(1)));
-				if ((items > 11) && lsp.at(11).contains('D'))
-					uid.setValid(false);
-				else
-					uid.setValid(true);
+				uid.setValid((items <= 11) || !lsp.at(11).contains('D'));
 
 				uid.setIndex(++m_numberid);
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic