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-06-03 04:25:25 +0200
commit3d99c1cbbabd5b0fb2f3e51d1ab40a319614fca7 (patch)
tree5bdde2c9d5b587a9f387a5d1151a597fd219f7ed
parentead8cb696e822d1975787df5da4c1767fcee1e0d (diff)
downloadtdepim-3d99c1cbbabd5b0fb2f3e51d1ab40a319614fca7.tar.gz
tdepim-3d99c1cbbabd5b0fb2f3e51d1ab40a319614fca7.zip
Fix segfault in IMAP folder parsing
Thanks to Francois Andriot for the patch! (cherry picked from commit 9b43d6e1802a64d4510d5c217eedef0c5d4cc6ff)
-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 cb3ac21e7..da1052a15 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);
+ }
}
}