summaryrefslogtreecommitdiffstats
path: root/redhat/tdepim/kdepim-3.5.13.1-fix_imapparser_segv.patch
blob: 4be0cd25f7db0903b74db91954754079fd852e8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
--- kdepim-3.5.13.1/kioslaves/imap4/imapparser.cc.segv	2012-09-08 12:06:42.000000000 +0200
+++ kdepim-3.5.13.1/kioslaves/imap4/imapparser.cc	2012-09-26 12:05:13.897737893 +0200
@@ -345,6 +345,7 @@
   parseOneWordC(result);        // *
   TQByteArray what = parseLiteral (result); // see whats coming next
 
+  if(!what.isEmpty ()) {
   switch (what[0])
   {
     //the status responses
@@ -482,6 +483,7 @@
       if (valid)
       {
         what = parseLiteral (result);
+	if(!what.isEmpty ()) {
         switch (what[0])
         {
         case 'E':
@@ -520,10 +522,12 @@
         default:
           break;
         }
+	}
       }
     }
     break;
   }                             //switch
+  }
 }                               //func
 
 
@@ -1915,9 +1919,10 @@
   if (!inWords.isEmpty() && inWords[0] == '{')
   {
     TQCString retVal;
-    ulong runLen = inWords.find ('}', 1);
-    if (runLen > 0)
+    long srunLen = inWords.find ('}', 1); // Can return -1, so use a signed long
+    if (srunLen > 0)
     {
+      ulong runLen = (ulong)srunLen;
       bool proper;
       ulong runLenSave = runLen + 1;
       TQCString tmpstr(runLen);