Sophie

Sophie

distrib > Mageia > 5 > i586 > by-pkgid > ddfeee3bedf84e44f20049fdcc070a8a > files > 26

kdepimlibs4-4.14.10-2.2.mga5.src.rpm

From e99682c321aafa0918cf929cba888036dd9ecfd5 Mon Sep 17 00:00:00 2001
From: Allen Winter <winter@kde.org>
Date: Mon, 28 Sep 2015 10:31:08 -0400
Subject: [PATCH 26/47] Check response content size before accessing it in
 search job

BUG: 351850
MERGE: not needed. this is a back port
---
 kimap/searchjob.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kimap/searchjob.cpp b/kimap/searchjob.cpp
index a31e6a796..028213643 100644
--- a/kimap/searchjob.cpp
+++ b/kimap/searchjob.cpp
@@ -426,14 +426,14 @@ void SearchJob::handleResponse( const Message &response )
   Q_D( SearchJob );
 
   if ( handleErrorReplies( response ) == NotHandled  ) {
-    if ( response.content[0].toString() == "+" ) {
+    if ( response.content.size() >= 1 && response.content[0].toString() == "+" ) {
       if (d->term.isNull()) {
         d->sessionInternal()->sendData( d->contents[d->nextContent] );
       } else {
         kWarning() << "The term API only supports inline strings.";
       }
       d->nextContent++;
-    } else if ( response.content[1].toString() == "SEARCH" ) {
+    } else if ( response.content.size() >= 2 && response.content[1].toString() == "SEARCH" ) {
       for ( int i = 2; i < response.content.size(); i++ ) {
         d->results.append( response.content[i].toString().toInt() );
       }
-- 
2.14.1