Bug 750012 - Part 1 - nsImapServerResponseParser fails while parsing custom message attribute data that is not enclosed in parentheses. r=bienvenu,a=Standard8.
authorDavid Lechner <david@lechnology.com>
Mon, 18 Jun 2012 11:25:20 -0500
changeset 12430 7636181f1a8f1d27ee7ac411596f53cc9f781d57
parent 12429 4bc10d6ac415ad021cebd5eff48d8f3da1addb14
child 12431 517923eb47b967954fddfe67122ce19057242c6c
push id599
push usermconley@mozilla.com
push dateMon, 16 Jul 2012 20:33:12 +0000
treeherdercomm-beta@c3489d5b7b65 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbienvenu, Standard8
bugs750012
Bug 750012 - Part 1 - nsImapServerResponseParser fails while parsing custom message attribute data that is not enclosed in parentheses. r=bienvenu,a=Standard8.
mailnews/imap/src/nsImapServerResponseParser.cpp
--- a/mailnews/imap/src/nsImapServerResponseParser.cpp
+++ b/mailnews/imap/src/nsImapServerResponseParser.cpp
@@ -1314,20 +1314,26 @@ void nsImapServerResponseParser::msg_fet
         if (!fServerConnection.GetCurrentUrl())
           return;
         fServerConnection.GetCurrentUrl()->GetImapAction(&imapAction);
         nsCAutoString userDefinedFetchAttribute;
         fServerConnection.GetCurrentUrl()->GetCustomAttributeToFetch(userDefinedFetchAttribute);
         if (imapAction == nsIImapUrl::nsImapUserDefinedFetchAttribute && !strcmp(userDefinedFetchAttribute.get(), fNextToken))
         {
           AdvanceToNextToken();
-          char *fetchResult = CreateParenGroup();
-          // look through the tokens until we find the closing ')'
-          // we can have a result like the following:
-          // ((A B) (C D) (E F))
+          char *fetchResult;
+          if (fNextToken[0] == '(') 
+            // look through the tokens until we find the closing ')'
+            // we can have a result like the following:
+            // ((A B) (C D) (E F))
+            fetchResult = CreateParenGroup();
+          else {
+            fetchResult = CreateAstring();
+            AdvanceToNextToken();
+          }          
           fServerConnection.GetCurrentUrl()->SetCustomAttributeResult(nsDependentCString(fetchResult));
           PR_Free(fetchResult);
         }
         else
           SetSyntaxError(true);
       }
       
         }