summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2012-05-30 03:55:37 +0200
committerSlávek Banko <slavek.banko@axis.cz>2012-05-30 03:55:37 +0200
commit9b43d6e1802a64d4510d5c217eedef0c5d4cc6ff (patch)
treef0f21a67095353f4d75470fb7a31611e34428033
parentb0c92b30a60f3290a9b8c393915bf623102d0fd6 (diff)
downloadtdepim-9b43d6e1802a64d4510d5c217eedef0c5d4cc6ff.tar.gz
tdepim-9b43d6e1802a64d4510d5c217eedef0c5d4cc6ff.zip
Fix segfault in IMAP folder parsing
Thanks to Francois Andriot for the patch!
-rw-r--r--kioslaves/imap4/imapparser.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/kioslaves/imap4/imapparser.cc b/kioslaves/imap4/imapparser.cc
index f916d8294..9e8d68c90 100644
--- a/kioslaves/imap4/imapparser.cc
+++ b/kioslaves/imap4/imapparser.cc
@@ -1354,10 +1354,10 @@ void imapParser::parseBody (parseString & inWords)
label = parseOneWordC (inWords);
}
- if (inWords[0] == ')')
+ if (!inWords.isEmpty () && inWords[0] == ')')
inWords.pos++;
}
- if (inWords[0] == ']')
+ if (!inWords.isEmpty () && inWords[0] == ']')
inWords.pos++;
skipWS (inWords);
@@ -1479,6 +1479,7 @@ void imapParser::parseFetch (ulong /* value */, parseString & inWords)
{
TQCString word = parseLiteralC(inWords, false, true);
+ if(!word.isEmpty()) {
switch (word[0])
{
case 'E':
@@ -1602,6 +1603,9 @@ void imapParser::parseFetch (ulong /* value */, parseString & inWords)
parseLiteralC(inWords);
break;
}
+ } else {
+ parseLiteralC(inWords);
+ }
}
}