** Fix for bug #547884
authorMilan Crha <mcrha@redhat.com>
Thu, 4 Sep 2008 09:00:23 +0000 (09:00 +0000)
committerMilan Crha <mcrha@src.gnome.org>
Thu, 4 Sep 2008 09:00:23 +0000 (09:00 +0000)
2008-09-04  Milan Crha  <mcrha@redhat.com>

** Fix for bug #547884

* camel-imap-folder.c: (imap_get_quota_info):
Do not crash on unexpected response, rather skip it.

svn path=/trunk/; revision=9477

camel/providers/imap/ChangeLog
camel/providers/imap/camel-imap-folder.c

index 267b9b2..7d519bb 100644 (file)
@@ -1,3 +1,10 @@
+2008-09-04  Milan Crha  <mcrha@redhat.com>
+
+       ** Fix for bug #547884
+
+       * camel-imap-folder.c: (imap_get_quota_info):
+       Do not crash on unexpected response, rather skip it.
+
 2008-09-03  Milan Crha  <mcrha@redhat.com>
 
        ** Fix for bug #548343
index c5b43ff..5970f36 100644 (file)
@@ -3784,6 +3784,7 @@ imap_get_quota_info (CamelFolder *folder)
                                const char *resp = response->untagged->pdata[i];
 
                                if (resp && g_str_has_prefix (resp, "* QUOTA ")) {
+                                       gboolean skipped = TRUE;
                                        size_t sz;
                                        char *astr;
 
@@ -3796,13 +3797,15 @@ imap_get_quota_info (CamelFolder *folder)
 
                                        if (resp && *resp == '(') {
                                                char *name;
-                                               const char *used, *total;
+                                               const char *used = NULL, *total = NULL;
 
                                                resp++;
                                                name = imap_parse_astring (&resp, &sz);
 
-                                               used = imap_next_word (resp);
-                                               total = imap_next_word (used);
+                                               if (resp)
+                                                       used = imap_next_word (resp);
+                                               if (used)
+                                                       total = imap_next_word (used);
 
                                                while (resp && *resp && *resp != ')')
                                                        resp++;
@@ -3822,11 +3825,15 @@ imap_get_quota_info (CamelFolder *folder)
                                                                        res = info;
 
                                                                last = info;
+                                                               skipped = FALSE;
                                                        }
                                                }
 
                                                g_free (name);
                                        }
+
+                                       if (skipped)
+                                               g_debug ("Unexpected quota response '%s'; skipping it...", (const char *)response->untagged->pdata[i]);
                                }
                        }
                        camel_imap_response_free (imap_store, response);