Bug 1444369 - fix crash renaming IMAP folder by changing %c to %S in format string. r=emk
authorJorg K <jorgk@jorgk.com>
Sat, 10 Mar 2018 11:56:27 +0100
changeset 31253 454ad0bb7a7e3f3cfe18ed6a09ac12e34e68f666
parent 31252 89edbe9d2bf22c6e4541c42bb1e1da868cdec6ea
child 31254 c1203e6ba317865eb92c0f4fdea14ee83f555e41
push id383
push userclokep@gmail.com
push dateMon, 07 May 2018 21:52:48 +0000
reviewersemk
bugs1444369
Bug 1444369 - fix crash renaming IMAP folder by changing %c to %S in format string. r=emk
mail/locales/en-US/chrome/messenger/imapMsgs.properties
mailnews/imap/src/nsImapMailFolder.cpp
suite/locales/en-US/chrome/mailnews/imapMsgs.properties
--- a/mail/locales/en-US/chrome/messenger/imapMsgs.properties
+++ b/mail/locales/en-US/chrome/messenger/imapMsgs.properties
@@ -143,17 +143,17 @@ imapConnectionRefusedError=Could not con
 
 imapNetTimeoutError=Connection to server %S timed out.
 
 # Status - no messages to download 
 imapNoNewMessages=There are no new messages on the server.
 
 imapDefaultAccountName=Mail for %S
 
-imapSpecialChar= The %c character is reserved on this imap server. Please choose another name. 
+imapSpecialChar2=The %S character is reserved on this imap server. Please choose another name. 
 
 imapPersonalSharedFolderTypeName=Personal Folder
 
 imapPublicFolderTypeName=Public Folder
 
 imapOtherUsersFolderTypeName=Other User's Folder
 
 imapPersonalFolderTypeDescription=This is a personal mail folder.  It is not shared.
--- a/mailnews/imap/src/nsImapMailFolder.cpp
+++ b/mailnews/imap/src/nsImapMailFolder.cpp
@@ -1584,23 +1584,21 @@ NS_IMETHODIMP nsImapMailFolder::Rename (
     if (msgWindow)
       msgWindow->GetRootDocShell(getter_AddRefs(docShell));
     if (docShell)
     {
       nsCOMPtr<nsIStringBundle> bundle;
       rv = IMAPGetStringBundle(getter_AddRefs(bundle));
       if (NS_SUCCEEDED(rv) && bundle)
       {
-        const char16_t *formatStrings[] =
-        {
-          (const char16_t*)(intptr_t)m_hierarchyDelimiter
-        };
+        const char16_t delimiter[2] = { (char16_t)m_hierarchyDelimiter, '\0' };
+        const char16_t *formatStrings[] = { delimiter };
         nsString alertString;
         rv = bundle->FormatStringFromName(
-          "imapSpecialChar",
+          "imapSpecialChar2",
           formatStrings, 1, alertString);
         nsCOMPtr<nsIPrompt> dialog(do_GetInterface(docShell));
         // setting up the dialog title
         nsCOMPtr<nsIMsgIncomingServer> server;
         rv = GetServer(getter_AddRefs(server));
         NS_ENSURE_SUCCESS(rv, rv);
         nsString dialogTitle;
         nsString accountName;
--- a/suite/locales/en-US/chrome/mailnews/imapMsgs.properties
+++ b/suite/locales/en-US/chrome/mailnews/imapMsgs.properties
@@ -148,17 +148,17 @@ imapConnectionRefusedError=Could not con
 
 imapNetTimeoutError=Connection to server %S timed out.
 
 # Status - no messages to download 
 imapNoNewMessages=There are no new messages on the server.
 
 imapDefaultAccountName=Mail for %S
 
-imapSpecialChar= The %c character is reserved on this imap server. Please choose another name. 
+imapSpecialChar2=The %S character is reserved on this imap server. Please choose another name. 
 
 imapPersonalSharedFolderTypeName=Personal Folder
 
 imapPublicFolderTypeName=Public Folder
 
 imapOtherUsersFolderTypeName=Other User's Folder
 
 imapPersonalFolderTypeDescription=This is a personal mail folder.  It is not shared.